title: Working With Dynamically Created Inputs
body: <p>I have a dynamic form that you can add elements. Like, you type a name, and then if you have to write a new name, you click on 'Add Name', and another textbox appears. </p>
  
  <p>Their names are <code>names[]</code>. I can process those inputs with PHP on the server-side. However, I want to make a calculation with those inputs, like writing all of them on the page as the user types. </p>
  
  <p>However, because those inputs, those textboxes are created dynamically, Javascript only selects the first textbox with the name <code>name[]</code>. </p>
  
  <p>Let me make it clear. This way it'll be better. I got a textbox. I input age in there. If I want to enter a new age, I click 'Add Age' button, and a new input box pops out. I write the new age value. And as I type, on a 3rd textbox, the average of those age values get printed. But because of those input boxes, with names <code>ages[]</code> are created on the execution time (not the compile time, I'm not sure these are the appropriate words for those. Probably not, because nothing is compiling? - or is it?), I can't process them. </p>
  
  <p>What must I do to solve this problem? </p>
  
  <p>I used both </p>
  
  <pre><code>$('input[name=ages\\[\\]]').change(function(){ 
   console.log('1');
  });
  </code></pre>
  
  <p>and </p>
  
  <pre><code>$('input[name=ages\\[\\]]').on('input', function() {
   console.log('2');
  });
  </code></pre>
  
  <p>but it didn't work. </p>
  
  <p>Thanks in advance. </p>