Need to use jQuery.find to find element with specific style
find, jquery
Solution
That's tricky as stated but is solvable other ways. The easiest is:
$("#adminMenu li ul:visible").hide();
assuming items are either hidden or not. Of course, considering you want to hide them all why not just:
$("#adminMenu li ul").hide();
Try and avoid changing CSS style directly. It's problematic. It's hard to reverse and as you're discovering hard to search for. Use a class instead:
#adminMenu li ul { display: none; }
ul.block { display: block; }
with:
$("#adminMenu li ul").removeClass("block");
or
$("#adminMenu li ul.block").removeClass("block");
Problem
Right... I need to find all < ul style="display: block;"> elements, so that I can set it do display:none. I think I'm on the right path here... but not quite there: ``` jQuery('#adminMenu li').find("ul").css('display'); ``` For advance users: how can I find and change the style with one line?