I know that this question has been asked before,but unfortunately those didn't seem to solve my issue.
I have a <table>
and i have to add dblclick
event to each of those,but i also am adding rows to the table using AJAX(after page load).
I have got it working but have posted 2 codes,one worked and other didn't.
a)This code works for me:
$(document).on("dblclick","td",function(){
//THIS WORKS FOR ELEMNTS ADDED AFTER PAGE LOAD
});
b)This code i tried earlier that didn't work:
$("td").on("dblclick","td",function(){
//THIS DIDN'T FOR ELEMNTS ADDED AFTER PAGE LOAD
});
Even tried adding a class to newly added <td>
and passed it in the second parameter,but it didn't seem to work.
Anyone please explain,whats the problem in the second case.?