Modify ↓
Ticket #10830 (closed bug: worksforme)
:first selector in delegate/on doesn't work
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | event | Version: | 1.7 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Markup:
<div id="test"> <a href="#">First Child</a> <a href="#">Second Child</a> </div>
jQuery:
var parent = $('#test');
parent.delegate('a:first', 'click', function(e){
e.preventDefault();
alert('clicked on the first child');
});
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

http://jsfiddle.net/timmywil/yf5g3/
Works for me. But I recommend using :first-child instead.