javascript - Do jquery still functions same with additional dom element via ajax as already displayed dom element? -


I am submitting a form through an AJAX and to edit and delete the fields added on the same page. The button that is already displayed with the button .. The fields already added are displayed on the page load and are displayed through the advancing Ajax. Delete button (Added after Ajax after submitting) Page Load Removal Buttons But not doing any action .. i have some misconceptions on jquery and this is going wrong and how can i work it

There are fields already added from the DB

  ... .  & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Email: & lt; / Td> & Lt; Td id = "u_email_2" & gt; Sachin@india.com< / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; A class = "btn btn-notice" id = "edit2" type = "button" href = "# editform" & gt; Edit & lt; / A & gt; & Lt; A class = "delete BTN BTN-threat" id = "delete_2" type = "button" href = "# editform" & gt; Remove & lt; / A & gt; & Lt; / Div & gt; ....  

After depositing on ajax, there are display values ​​

   & Lt; Td id = "u_email_14" & gt; Hj & lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; A class = "btn btn-notice" id = "edit14" type = "button" href = "# editform" & gt; Edit & lt; / A & gt; & Lt; A class = "delete BTN BTN-hazard" id = "delete_14" type = "button" href = "# editform" & gt; Remove & lt; / A & gt; & Lt; / Div & gt;  

After clicking on the deleted button I am calling jquery which is working properly with the DB display division, but for the second case when I use the devil form Ajax Calling me, the Delete button is not working as if with case 1

  & lt; Script type = "text / javascript" & gt; $ (Function () {$ ("Delete"). Click (function (e) {var r = Confirm ("Do you want to change status?") {$ Id = $ (this) .Parent () Attr ('id'); alert ($ id); $ .ajax ({type: 'gET', url: "include / process.php", data: {id: $ id, todel: 'delete'}, Cache: true, async: false, error: function {alert ('error');}, success: function (data) {warning (data); // on_success_my_action}}) return false;}}); );  

If you want to manage dynamic content, then you must .on () Must use:

jQuery only allows to already manage the contents when the DOM loads.


Comments