I am trying this simple code here. It doesn’t work for either the actual click event or the one which is commented out. Can anybody explain why? I have had issues with not previously also…
I am trying this simple code here . It doesn’t work for either the
Share
.livehas been deprecated in jQuery since v1.7, and has been removed in v1.9.You should replace it with
.on()..onhas 2 syntaxes for binding elements, whereas.liveonly had 1.If the element exists at the time you are binding, you do it like this:
You can even use the shorthand:
If the element does not exist at the time, or new ones will be added (which is what
.livewas normally used for), you need to use “event delegation”:NOTE: You want to bind to the closest static element, not always
document.