Possible Duplicate:
jQuery 1.7 – Turning live() into on()
Just switching my code from "live" to "on" and some events just don’t fire any more, here is an example, can anyone please help out saying what’s wrong with it? It WORKED 100% correct with "live" instead of on method before….
$('a#doBulkLink').on('click', function (e) {
createLabelsWithDestinationFolders();
$('label.moveDocDestinationFolder').on('click', function (e) {
doSomeAjaxStuffWithLabels();
e.stopImmediatePropagation();
});
e.preventDefault();
});
You cannot replace
live()withon()simply by changing the function name toon(); the signature changes as well.… becomes ….
In it’s current form, what you have is a direct replacement for
bind()(of whichclick(),change()etc are aliases). As such, the handler is been bound directly to the element, rather than binding the handler to thedocumentand taking advantage of event bubbling, which is whatlive()did.