dom - JavaScript get elements by class name and tag name -


i wanted list of dom elements class name , tag name in javascript, not using jquery.

for example need <ul> elements class .active

var elements = document.getelementsbytagname("ul"); var activeelements = document.getelementsbyclassname('active') 

what fastest , best way in pure javascript.

no external libraries jquery or cheerio

document.queryselectorall('ul.active') 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -