/    Sign up×
Community /Pin to ProfileBookmark

Basic DOM related question, please help

I am trying to set a var to a Tagname nested inside of a class name. In other words, its an un-ordered list with a class name of “menu-nav” which also has several un-ordered lists nested inside of it which I would like to set a var to as well.

My website HTML is generated using a CMS so i’m unable to assign class names nor IDs to those nested unordered lists. I can’t use GetElementbyTagname because that would get all un-ordered lists, and I only one to get those nested inside of “menu-nav.

Setting a var for the “menu-nav” is the easy part. I would just use the GetElementByClassname for that. The problem is after I’ve set a var for that, how would I get the nested un-ordered lists which are nested inside the “menu-nav” root unordered list.

I just don’t know enough about javascript to figure this out on my own. Please help me out.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rnd_meJun 27.2011 — use jQuery or .querySelectorAll, then use a "ul.menu-nav ul" selector to grab nested ULs...
Copy linkTweet thisAlerts:
@jawauneauthorJun 27.2011 — So would it look like this? document.JQuery(ul.menu-nav ul)

is that right?
×

Success!

Help @jawaune spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...