Side navigation
#10830 closed bug (worksforme)
Opened November 18, 2011 05:35PM UTC
Closed November 18, 2011 05:40PM UTC
Last modified November 18, 2011 05:46PM UTC
:first selector in delegate/on doesn't work
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | event | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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'); });
http://jsfiddle.net/timmywil/yf5g3/
Works for me. But I recommend using :first-child instead.