groups

name language licence
JS : Date du client en javascript Other Other
HTML5 : Structure par defaut + commentaires Other Other
JOOMLA : Création de templates personnalisés Other Other
JQUERY : Aide sur live() (anglais) Other Other
CSS : ordre des paramètres pour les supers propriètés margin et padding CSS Other
PHP/JAVASCRIPT : detecter un iphone ou ipod touch Other Other
PHP : recuperer l'adresse IP du visiteur Other Other
JQUERY : Aide sur live() (anglais) JS-JQuery Other

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 >



language: Other
licence: Other

JQUERY : Aide sur live() (anglais)

options: view full snippetsend to code collector
Events/live

live( type, fn )

Added in jQuery 1.3: Binds a handler to an event (like click) for all current - and future - matched element. Can also bind custom events.
Possible event values: click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, keydown, keypress, keyup 
Currently not supported: blur, focus, mouseenter, mouseleave, change, submit
Unlike .bind(), only a single event can be bound in each call to the .live() method.

This method works and behaves very similarly to jQuery's bind method but with a few important distinctions:

When you bind a "live" event it will bind to all current and future elements on the page (using event delegation). For example if you bound a live click to all "li" elements on the page then added another li at a later time - that click event would continue to work for the new element (this is not the case with bind which must be re-bound on all new elements).
Live events do not bubble in the traditional manner and cannot be stopped using stopPropagation or stopImmediatePropagation. For example, take the case of two click events - one bound to "li" and another "li a". Should a click occur on the inner anchor BOTH events will be triggered. This is because when a $("li").bind("click", fn); is bound you're actually saying "Whenever a click event occurs on an LI element - or inside an LI element - trigger this click event." To stop further processing for a live event, fn must return false. This also means, that if any of the parent nodes for the "li" has a click event handler that returns false, the click event will never reach the document node, and as a consequence the live event will never be triggered.
Live events currently only work when used against a selector. For example, this would work: $("li a").live(...) but this would not: $("a", someElement).live(...) and neither would this: $("a").parent().live(...).
.live() behaves similarly to the popular liveQuery plugin but with a few major differences:
	
(Continues...)