Reputation: 576
I have the current selector for non-dynamic click
events:
$( "#names > tbody > tr, .projcontainer > tbody > tr:not(:first)")
How do I put this in an on
bind event for dynamically loaded contents? I tried this and it (expectedly) didn't work:
$( "#names > tbody > tr, .projcontainer > tbody > tr:not(:first)" ).on("dblclick", function() {
loadPerson($(this).children().first().text());
});
I know that in previous examples I have had to do normal click events like this:
$("#names").on("click", "tr", ....
But I'm not sure how to translate that with more complex selectors..
Upvotes: 1
Views: 21
Reputation: 218722
This should work for your dynamically injected elements.
$(document).on("dblclick",
"#names > tbody > tr, .projcontainer > tbody > tr:not(:first)",function() {
console.log('event happened');
});
Upvotes: 2