aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes jQuery live() custom events Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "jQuery live() custom events" Watch "jQuery live() custom events" New topic
Author

jQuery live() custom events

Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

With the livequery plugin I can do something like this:



With jQuery's live() function, I have to do this



Am I missing something or do we have to call trigger to force the custom live event? The jQuery demo does this because the live event is triggered by another event. I don't see how this is better than not using live() at all, since a manual trigger is required.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

The two are not the same. In the livequery() example, you are establishing a "match handler" -- one that automatically gets called when a matching element is created. live() has no such facility.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

Bear Bibeault wrote:live() has no such facility.





Ok, thanks Bear.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

A little history. In jQuery 1.2, live() did not exist. The LiveQuery plugin provided two facilities:
  • Establishing match/mismatch handlers (called when a matching element comes into, or goes out of, being).
  • "Live" events

  • The latter facility was incorporated into jQuery core as part of its event handling facility. The former was not. I still use the LiveQuery plugin for matching handling.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: jQuery live() custom events
     
    Similar Threads
    Convert livequery to live/delegate
    livequery and trigger
    jQuery.live() automatic trigger?
    anchor tag , click and livequery
    Has DIV tag Finished Loading