I’m having trouble with on(), since live() is deprecated.
This doesn’t seem to work:
$('body').on("click", ".myButton", console.log("clicked"));
When I refresh the page, the console immediately says “clicked” even though I haven’t clicked anything, but does not fire when I actually click on it.
Also, it would seem more performant to apply this to the DIV the button is in, rather than the huge scope of BODY. Is this true?
1 Answer