You cannot do this with live (), although you can do it with a custom event.
The implication with live () is that you add elements dynamically. Dynamically loaded elements must be executed as a result of some event or AJAX callback, so a new event binding is established in the callback event.
callback event... //code thatadds the new elements... jQuery('selector that identifies the new elements').bind("ajaxSend", function(event, xhr, ajaxOptions) { // do something });
You might want to wrap your code in a function.
Check out the comments copied from http://api.jquery.com/live/ here
The .live () method is useful, but because of its special approach, it cannot be simply replaced with .bind () in all cases. Specific differences:
DOM traversal methods are not supported for finding elements to send to .live(). Rather, the .live() method should always be called directly after a selector, as in the example above. To stop further handlers from executing after one bound using .live(), the handler must return false. Calling .stopPropagation() will not accomplish this. In jQuery 1.3.x only the following JavaScript events (in addition to custom events) could be bound with .live(): click, dblclick, keydown, keypress, keyup, mousedown, mousemove, mouseout, mouseover, and mouseup. As of jQuery 1.4 the .live() method supports custom events as well as all JavaScript events that bubble. As of jQuery 1.4.1 even focus and blur work with live (mapping to the more appropriate, bubbling, events focusin and focusout). As of jQuery 1.4.1 the hover event can be specified (mapping to mouseenter and mouseleave, which, in turn, are mapped to mouseover and mouseout).
source share