javascript - HTML Form not passing inputs added dynamically from jQuery -


i'll keep short , simple, i've browsed , browsed around here , other sites unable find solution issue: i've got html form works fine. update i'm doing allows end user add new tr dynamically table contain 4 input fields. each input field has name, id, , class set. (this 1 of solutions posting.) there's span user clicks creates new tr inputs. functionality of works perfectly, , new tr gets created , inputs there , need them to. however, when submit form, doesn't recognize dynamically created inputs.

i've debugged in both chrome , ff, can see other form elements being passed through, except dynamically created elements. way i'm trying reference data on receiving page not issue (another solution user having same issue,) since data isn't being passed in first place.

if serialize form , alert before submitting it, not pick on dynamically created elements.

below jquery code, appreciated, , in advance!

var kit_rows = 0; var btn_add_rows_i = 1; var btn_add_rows_x = '';  $('#text_add_rows').click(function() {  kit_rows += 1;  btn_add_rows_x = ''; btn_add_rows_x += "<tr>";     btn_add_rows_x += "<td class='main'> model #: ";     btn_add_rows_x += "<input type='text' name='kit_model" + btn_add_rows_i + "' id='kit_model" + btn_add_rows_i + "' class='kit_model'> &nbsp; </td>";      btn_add_rows_x += "<td class='main'> qty: ";     btn_add_rows_x += "<input type='text' name='kit_qty" + btn_add_rows_i + "' id='kit_qty" + btn_add_rows_i + "' class='kit_info kit_qty'> &nbsp; </td>";      btn_add_rows_x += "<td class='main'> price: ";     btn_add_rows_x += "<input type='text' name='kit_price" + btn_add_rows_i + "' id='kit_price" + btn_add_rows_i + "' class='kit_info kit_price' value='0.00'> &nbsp; </td>";      btn_add_rows_x += "<td class='main'> wholesale: ";     btn_add_rows_x += "<input type='text' name='kit_wholesale" + btn_add_rows_i + "' id='kit_wholesale" + btn_add_rows_i + "' class='kit_info kit_wholesale' value='0.00'> &nbsp; </td>"; btn_add_rows_x += "</tr>";  $('#tr_last').before(btn_add_rows_x);  btn_add_rows_i++;  alert($('#cat').serialize());  }); 

my questions are:

once $('#tr_last').before(btn_add_rows_x); content, shouldn't html form pick on content automatically?

does jquery's "before" function job or there different should using allow form pick on new content?

have on jsfiddle. whether satisfies requirement

enter code herehttp://jsfiddle.net/gurunathana/8eeqwhyf/

regret if mistakenly understand query.

thanks,


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -