jQuery - How to combine has() and gt()
Posted
by KatieK
on Stack Overflow
See other posts from Stack Overflow
or by KatieK
Published on 2010-04-28T04:13:11Z
Indexed on
2010/04/28
4:23 UTC
Read the original article
Hit count: 251
query
|JavaScript
With jQuery 1.4.2, I can't figure out how to combine has() with :gt. I'd like to select any ul which contains more than 3 lis, so here's what I've tried:
$(document).ready(function(){
$("ul.collapse:has(li:gt(2))")
.each( function() {
$(this).css("border", "solid red 1px");
});
});
This does work with the 1.2.6 jQuery library, but not 1.3.2 or 1.4.2.
I'd appreciate any help in understanding what's going on here. Thanks!
© Stack Overflow or respective owner