Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery live with the ready or load event

I'm using the jQuery Tools tooltip plugin, which is initialized with $('selector').tooltip(). I'd like to call this on any current or future .tooltipper element. I figured that the following would work:

$('.tooltipper').live('ready', function(){
  $(this).tooltip()
}

But it was unsuccessful---the ready event did not fire. The same for load. I've read that livequery can produce the result of I'm looking for, but surely there is a way to use jQuery .live() to pull it off, considering the documentation says that it works for all jQuery events, of which I believe ready is one.

like image 504
Steven Avatar asked Jul 07 '10 15:07

Steven


1 Answers

Quoted from the jQ API (http://api.jquery.com/live/):

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.

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 mouseleave").

.live() does not appear to support the ready event.

like image 64
HurnsMobile Avatar answered Sep 20 '22 18:09

HurnsMobile