I was using the $.click() method for triggering some events. But then I needed to set some events for some HTML elements before the elements were declared. Let\
You missed the three-argument version:
$('body').on('click', 'div.hide', function() { ... });
That puts the handler on the but it catches the events that bubble and invokes the handler when the target element matches the selector (the second argument).
The handler doesn't have to go on the The "on" method replaces the older "live" and "delegate" methods, as well as "bind" itself.; it can be any parent container element of your