javascript - Working With Dynamically Created Inputs -


I have a dynamic form that you can add elements like, you type in a name, and then if you To write a new name, you click on 'Add Name', and another text box appears.

Their names are names [] . I can process those inputs with PHP on the server side. However, I want to make a calculation with those inputs, such as by typing on all types of pages as the user type

However, because these inputs, those textboxes are dynamically created, Javascript only selects the first text box with the name name [] < P> Let me clear it. In this way it would be better to get me a textbox I input in the age of the age if I want to enter a new era, then I will click on the 'Add Age' button, and a new input box will be pop out. I write the value of the new age and as I type, on the third lesson text, the values ​​of those ages are printed on average. But due to those input boxes name age [] with execution time (not on collection time, I'm not sure that these are suitable words for those people. Probably not, because there is nothing compilation ? - or is it?), I can not process them.

What should I do to solve this problem?

I used both

  $ ('input [name = ages] \ \ [\\]]'). Change (function () {console.log ('1');});   

and

  $ ('input [name = age \\ [\\]]'). ('Input', function () {Console.log ('2');});   

But it was not working.

Thanks in advance

Try to use:

  $ (document) .on ('change', 'input [name = age \\ [\\]]', function () {console.log ('2');});    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -