简体   繁体   中英

Set values in fields created dynamically

have a simple registration form which can replicate the same N times for N inscriver people at once.

I have to set the values ​​of the VALUE field depending on selected SELECT option Participant independently for each registration form dynamically created option.

I tried several things but I can not make the event ( on change) fired from a given SELECT change only the value of that piece of form created in Javascript field.

I would like to create fields where SELECT fired an event that only alter its respective VALUE field according to the selected users in the SELECT option and that the trigger its SELECT , the VALUE field of the registration form to receive the value of the select value changed. I want this to happen independently created for all sections on the form .

I'm having the following problem, it seems that other SELECTS created dynamically follow the original select . Are not independent.

How can I fix this? The link below is the source code and the same

link: http://jsbin.com/lupeweha/5

I see you actually fire the event on the select by calling the "select" element, which then fires the same event on ALL the selects! Create ids, and then call your functions independently.

function bindSelect(){
   $('select').on('change', function() {
   ....

   // hey, here all the selects get this function, on change.

   $('#main-select').on('change', function() {
   ...

   $('#other-select1').on('change', function() {
   ...

   $('#other-select2').on('change', function() {

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM