title: Access and disable dynamically created fields
body: <p>I have created a dynamic form (add form fields by press button "Hinzufügen").</p>
  
  <p>But i need some functions and dosent get along with it :-(</p>
  
  <p>The dynamic creation works fine also post the form as array works fine.</p>
  
  <p>But now i need to disable some fields when new fields are created but i dont find the selectors to deal with it ...</p>
  
  <p>What I want to do:</p>
  
  <p>When a new fields are created all the "von" <code>(data[?][von])</code> and the "bis" <code>(data[?][bis])</code> fields from the fields before should be disabled.</p>
  
  <p>On the new fields the "von" field should contain the data from the last "bis" field and should also be disabled.</p>
  
  <p>Here is the Code:</p>
  
  <pre><code>$(document).ready(function() {
      var MaxInputs       = 100; //maximum input boxes allowed
      var InputsWrapper   = $("#InputsWrapper"); //Input boxes wrapper ID
      var AddButton       = $("#AddMoreFileBox"); //Add button ID
      var submit1       = $("#submit"); 
  
      var x = InputsWrapper.length; //initlal text box count
      var FieldCount=1; //to keep track of text box added
  
      $(submit1).click(function (e)  //on add input button click
      {
          $("#abser").submit(); 
      });
  
      $(AddButton).click(function (e)  //on add input button click
      {
          if(x &lt;= MaxInputs) //max input box allowed
          {
              FieldCount++; //text box added increment
              //add input box
              $(InputsWrapper).append('&lt;div style="border: 1px solid silver; margin: 5px 5px 0px 0px; padding:8px 8px 8px 8px; background-color:#3391B0;"&gt;&lt;label&gt;&lt;font color="#FFFFFF"&gt;Weg:&lt;/font&gt;&lt;/label&gt;&lt;/div&gt;&lt;div style="border: 1px solid silver; margin: 0px 5px 0px 0px; padding:8px 8px 8px 8px; background-color:#EDF8FE"&gt;&lt;p&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" class="formtable" &gt;&lt;tr class="tablebg"&gt;&lt;td &gt;&lt;label class="inline"&gt;Von:&lt;/label&gt;&lt;input name="data['+ FieldCount +'][von]" type="text"   class="text nextto" /&gt;&lt;/td&gt;&lt;td&gt;&lt;label class="inline"&gt;Bis:&lt;/label&gt;&lt;input name="data['+ FieldCount +'][bis]" type="text" class="text nextto" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;&lt;p&gt;&lt;label class="inline" for="art"&gt;Art:&lt;/label&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;select name="data['+ FieldCount +'][art]" class="text nextto"&gt;&lt;option value="Ortsaugenschein"&gt;Ortsaugenschein&lt;/option&gt;&lt;/select&gt;&lt;/p&gt;&lt;p&gt;&lt;label class="inline"&gt;Ort:&lt;/label&gt;&lt;input name="data['+ FieldCount +'][ort]" type="text" class="text inline" /&gt;&lt;/p&gt;&lt;p&gt;&lt;label class="inline"&gt;Detail:&lt;/label&gt;&lt;/br&gt;&lt;textarea name="data['+ FieldCount +'][detail]"&gt;&lt;/textarea&gt;&lt;/p&gt;&lt;/div&gt;');
              x++; //text box increment
          }
          return false;
      });
  
      $("body").on("click",".removeclass", function(e){ //user click on remove text
          if( x &gt; 1 ) {
              $(this).parent('div').remove(); //remove text box
              x--; //decrement textbox
          }
          return false;
      }) 
  });
  </code></pre>
  
  
  
  <pre><code>&lt;center&gt;&lt;h6&gt;Absenz erfassen&lt;/h6&gt;&lt;/center&gt;
  &lt;div class="grid_12"&gt;
      &lt;div class="grid_3"&gt;&amp;nbsp;&lt;/div&gt;
      &lt;div class="grid_6"&gt;
          &lt;form id="abser" action="addon/absdb/testpost.php"  method="post"&gt;
              &lt;label class="inline"&gt;Datum:&lt;/label&gt;
              &lt;input type="hidden" name="datum" id="dtp_input2" value="" /&gt;
              &lt;div id="InputsWrapper"&gt;
                  &lt;div style="border: 1px solid silver; margin: 5px 5px 0px 0px; padding:8px 8px 8px 8px; background-color:#3391B0;"&gt;
                      &lt;label&gt;&lt;font color="#FFFFFF"&gt;Weg:&lt;/font&gt;&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div style="border: 1px solid silver; margin: 0px 5px 0px 0px; padding:8px 8px 8px 8px; background-color:#EDF8FE"&gt;
                      &lt;p&gt;
                          &lt;table width="100%" border="0" cellspacing="0" cellpadding="0" class="formtable" &gt;
                              &lt;tr class="tablebg"&gt;
                                  &lt;td&gt;
                                      &lt;label class="inline"&gt;Von:&lt;/label&gt;&lt;input name="data[1][von]" type="text"   class="text nextto" /&gt;
                                  &lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;label class="inline"&gt;Bis:&lt;/label&gt;&lt;input name="data[1][bis]" type="text" class="text nextto" /&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;
                      &lt;/p&gt;
                      &lt;p&gt;
                          &lt;label class="inline" for="art"&gt;Art:&lt;/label&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                          &lt;select name="data[1][art]" class="text nextto"&gt;
                              &lt;option value="Ortsaugenschein"&gt;Ortsaugenschein&lt;/option&gt;
                          &lt;/select&gt;
                      &lt;/p&gt;
                      &lt;p&gt;
                          &lt;label class="inline"&gt;Ort:&lt;/label&gt;
                          &lt;input name="data[1][ort]" type="text" class="text inline" /&gt;
                      &lt;/p&gt;
                      &lt;p&gt;
                          &lt;label class="inline"&gt;Detail:&lt;/label&gt;
                          &lt;/br&gt;
                          &lt;textarea name="data[1][detail]"&gt;&lt;/textarea&gt;
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;p&gt;
                  &lt;input type="submit" class="submit" id="AddMoreFileBox" value="Hinzufügen" /&gt;
                  &lt;input type="submit" class="submit" id="submit" value="Speichern" /&gt;
              &lt;/p&gt;
          &lt;/form&gt;
      &lt;/div&gt;
      &lt;div class="grid_3"&gt;
          &amp;nbsp;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>