On Aug 19, 2008, at 8:09 AM, Giovanni Battista Lenoci wrote:
Hi, I have this code:
<ul>
<li>
<ul class="menu">
<li>...</li>
</li>
<li>
<ul class="menu active">
<li>...</li>
</li>
<li>
<ul class="menu">
<li>...</li>
</li>
</ul>
I want to set css property display:none to all the elements that are
not active.
I'm looking at the doc on ":not" selector, I've tried:
$(':not(.active)').css({'display:none'});
But doesn't works... Where I'm doing wrong?
The selector looks fine. The .css() method is where you're having a
problem. Try this instead:
$(':not(.active)').css({display: 'none'});
Note the use of quotation marks around the value only ('none'). You
can put a separate set around the key ('display') as well, but you
can't have a single set wrapping both key and value.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com