Skip to main content

Bug Tracker

Side navigation

#4089 closed bug (invalid)

Opened February 06, 2009 03:28PM UTC

Closed February 07, 2009 02:40AM UTC

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')});

Attachments (0)
Change History (1)

Changed February 07, 2009 02:40AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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.