Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting all <ul> with id="foldinglist" 1

Status
Not open for further replies.

RedRobotHero

Technical User
May 2, 2003
94
CN
I'm changing a folding menu script. The last thing I need to change is in the persistance code. I need to make it default to closing the menu when there is no persistence cookie.

To do this, I need to take all the <ul> with an id of &quot;foldinglist&quot; and change the style to &quot;display:none&quot;.


What is the easiest way for me to selectt all the <ul> with an id of &quot;foldinglist&quot;?
 
<ul id=&quot;foldinglist&quot;>
<li>hi
</ul>
<ul id=&quot;foldinglist&quot;>
<li>there
</ul>
<script>
u=document.getElementsByName(&quot;foldinglist&quot;)
for(i=0;i<u.length;i++){
u.style.display=&quot;none&quot;
}
</script>

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top