I have Javascript code that is supposed to do stuff on a click, but it isn't doing anything. It's essentially a button on a pane that slides in. When I click the button, I expect something to happen. This button, though, is populated when an AJAX call completes because the AJAX call is fetching some HTML that contains the button.
Here's my code to set up the button:
$("#btn-delete-setup").on("click", function() {
console.log("clicked");
_deleteFunction();
//return false;
});
Because the Javascript is loaded before that pane and button are rendered from the AJAX call, does this mean the button will not respond to my .on("click")
code? Is my button not responding because when Javascript loads, it hasn't found the button to bind to?