I am trying to have a click event on < tr > tag of my table that's dynamically generated. While registering event for 1st time, there is no exception. But Function is not being called if I click on tablerow.
I tried getElementById also, which is even giving extra exception while registering on click event.
Please help.
Below is part of my code:
Script:
$("#empName").on("click", function(){
alert("Hi");
});
HTML:
$(obj).find('#abc tr:last').after("<tr class='odd' id='empName'><td>"+emp+"<br/>"+eventName+"</br>"+ind+"</br>"+loc +"</td></tr>");