Opened 14 years ago
Closed 14 years ago
#4089 closed bug (invalid)
live() does not work with closest()
Reported by: | ReneLeonhardt | Owned by: | john |
---|---|---|---|
Priority: | minor | Milestone: | 1.3.2 |
Component: | selector | Version: | 1.3.1 |
Keywords: | live, closest | Cc: | |
Blocked by: | Blocking: |
Description
I have a tablesorter where the first column contains a checkbox.
This works: $('table.tablesorter tbody td:first-child').live('click', function(e){alert('clicked')});
This doesn't work: $('table.tablesorter tbody td:first-child :checkbox').closest('td').live('click', function(e){alert('clicked')});
Note: See
TracTickets for help on using
tickets.
http://docs.jquery.com/Events/live#typefn
"Live events currently only work when used against a selector."
This is because when the event bubbles up to the document, the selector alone is used to determine whether there is a match. You can't use any chain filters like
.closest()
or.parent()
after the selector.