I have a form that I add above a table to add a new row but for some reason I do not Can capture capture event line with input form elements looks fine on top of table.
$ ("# btn_addrow"). ("Click", function () {$ ("# tbl_list"). Prepended ("& lt; tr>
I can not get to trigger this event:
$ ("body"). ("Submit", "#frm_add", function} {event.preventDefault (); Warning ('test'); / * $ .ajax will save the function here; itemprop = "text"> Your code works, see: Although instead of putting the form with the ID you should include the form with the class. ID is always unique , So I will do this:
$ ("# btn_addrow"). ("Click", function () {$ ("# tbl_list") .prepend ("& lt ; Tr & gt; & lt; form class = 'frm_add' & gt; & lt; td & gt; & lt; input Tar = 'text' name = 'date' & gt; & lt; / td> & lt; td & gt; & lt; input type = 'text' name = 'note' & gt; & lt; / td & Gt; & lt; td & gt; & lt; input type = 'Submit' value = 'Add Row' & gt; & lt; / td & gt; & lt; / form & gt; & lt; / tr & Quot;);}); $ ("Submit", ".frm_add", function {event} {event.preventDefault (); Warning ('test'); / * $ .ajax Function will save here * *});
Update
Firefox will not work in Firefox, due to Firefox bug, Call her To make this code work, you can do some types of following, add and id or identifier in your table, instead of wrapping the form in the row, wrap the new row in the form, and insert the jQuery insertAfter method to inject new Use
$ ("# btn_addrow"). ("Click", function () {$ ("& lt; form class = 'frm_add' & gt; & lt; tr & gt; & lt; td & gt; & lt; input type = 'text' name = 'Date' & gt; & lt; / td> & lt; Td & gt; & lt; Input Type = 'Text' name = 'Note' & gt; & lt; / td & gt; & lt; Td> & lt; Input Type = 'Submit' value = 'Add Row' & gt; & lt; / td> & lt; / Tr & gt; & lt; / form & gt; "). InsertAfter ($ ("$ my_table")}} $ ("Submit", ".frm_add", function (event) {event.preventDefault (); Warning ('test'); / * $ .ajax will save the save here * *});
Comments
Post a Comment