Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have javascript function:

var el = document.getElementsByClassName('dixc');

now I want to find all the element contained in the el, I mean is it possible something like this:

var elchild = el.getElementsByClassName('navNew');

How can I find child elements?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
310 views
Welcome To Ask or Share your Answers For Others

1 Answer

See querySelectorAll(), which has slightly better browser support than getElementsByClassName() (with the exception of Firefox versions older than 3.5):

document.querySelectorAll(".dixc .navNew");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...