SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Nested List Style Menu DOM question

    Hello,

    I have a quick question re accessing child elements using DOM for a nested list style menu (I actually have four levels of menu).

    e.g.

    HTML Code:
    <ul>
    	<li>First Level
    		<ul>
    			<li>Second Level
    				<ul>
    					<li>Third Level
    						<ul><li>Fourth Level</li></ul>
    					</li>
    				</ul>
    			</li>
    		</ul>
    	</li>
    </ul>
    I have a problem where the following styles not only get applied to the ul that I want it to style but also the next level down ul as well. (so I'm trying to style level 2, but the level 3 ul is affected also.


    Code:
    document.getElementById('theID').getElementsByTagName('ul')[0].style.visibility='hidden';
    ???

    Thank you.

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    visibility:hidden; and display:none; hide the element and all of its children.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •