I am dynamically adding a table row (tr
) to my table and these tr
tags contain some links.
I have a jQuery script which is invoked when the links inside the tr
are clicked.
The script is not working for these links. It works when I reload the page and the tr
is populated from the server side.
How can I overcome this problem?
$(".comment-like").on('click',function() {
var spanEle = $(this).closest('li').find('.comment-like-count');
if (spanEle.length) {
var newCount = parseInt(spanEle.text(),10);
spanEle.text(newCount + 1);
}
});