Finding a dynamically generated button as a descendant of a div
I need to find a button inside a div (and do a function on click), I know
how to do it in a regular way:
$(".some_div").find(".button").click(function () {
//do something
)};
The problem is I have to use the .on function because the content is
loaded with AJAX, so I am using this:
$(document).on('click', '.button', function(event){
//do something
)};
I need a combination of those two. I tried this:
$(document).on('click', '.some_div' '.button', function(event){
//do something
)};
Did not work.
No comments:
Post a Comment