Bug Tracker

Modify

Ticket #5425 (closed enhancement: invalid)

Opened 4 years ago

Last modified 4 years ago

why does live() need to run a selection during intit?

Reported by: Leeoniya Owned by: brandon
Priority: major Milestone: 1.4
Component: event Version: 1.3.2
Keywords: live performance Cc: leeoniya@…
Blocking: Blocked by:

Change History

comment:1 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid

jQuery can't have fore-knowledge of what will happen against the jQuery set - if so then that would be quite impressive.

Instead we recommend that you use event delegation instead, like the following:

$("#someRootTable").click(function(e){
  $(e.target).closest("td.foo", this).each(function(){
     // Your code goes here.
  });
});

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.