इसलिए मेरे पास यह बटन है जो तालिका में एक नई पंक्ति जोड़ता है, हालांकि मेरी समस्या यह है कि यह .new_participant_formएपेंड विधि के लागू होने के बाद अब क्लिक इवेंट को नहीं सुनता है।
Add New Entry पर क्लिक करें फिर फॉर्म नाम पर क्लिक करें।
$('#add_new_participant').click(function() {
var first_name = $('#f_name_participant').val();
var last_name = $('#l_name_participant').val();
var role = $('#new_participant_role option:selected').text();
var email = $('#email_participant').val();
$('#registered_participants').append('<tr><td><a href="#" class="new_participant_form">Participant Registration</a></td><td>'+first_name+ ' '+last_name+'</td><td>'+role+'</td><td>0% done</td></tr>');
});
$('.new_participant_form').click(function() {
var $td = $(this).closest('tr').children('td');
var part_name = $td.eq(1).text();
alert(part_name);
});
});
एचटीएमएल
<table id="registered_participants" class="tablesorter">
<thead>
<tr>
<th>Form</th>
<th>Name</th>
<th>Role</th>
<th>Progress </th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#" class="new_participant_form">Participant Registration</a></td>
<td>Smith Johnson</td>
<td>Parent</td>
<td>60% done</td>
</tr>
</tbody>
</table>
<button id="add_new_participant"></span>Add New Entry</button>

new_participant_formतत्व से जुड़ी है जो पहले से ही दस्तावेज़ में है। आपके द्वारा बाद में जोड़े जाने वाले तत्वों के लिए इसे काम करने के लिए, आप इवेंट डेलिगेशन का उपयोग कर सकते हैं, क्योंकि dystroy ने प्रदर्शन किया है, या इसे डालने से पहले प्रत्येक एंकर को हैंडलर संलग्न करें (पूर्व अधिक कुशल है)।