For now, you should switch to . on () if you are using 1.7+, here is the answer to your delegate question:
jQuery live () essentially associates an event handler with the entire widow.document object, which requests every event (corresponding to your type of event) if the source matches your selector. If that were the case, then it would start the handler. This allows you to handle events originating from dynamically added elements.
jQuery delegate () is similar to live (), except that you can specify a selector for the container, not just window.document.This means that you will interrogate the source of fewer events and therefore improve performance.
If you want to accurately reproduce the behavior of live () by going to delegate (),
$(selector).live('eventType', handlerFunc);
becomes:
$(document).delegate(selector, 'eventType', handlerFunc);
It is important to note that you are not typing anything by storing $ (document) in the delegate () call. You must change this selector to a more specific container where your dynamic elements will be created.
source share