Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
84
rated 0 times [  86] [ 2]  / answers: 1 / hits: 59277  / 12 Years ago, sat, july 14, 2012, 12:00:00

I'm using a custom modernizer config which has selected the features I employ in my page (and only those features).



So, I'd like to simply grab the className of the <html> of the page so I can check to see how many no- prefixed classes are present (maybe checking classlist.match(/no-/g).length) and determine if my javascript should just give up.



It's not clear whether I should use



document.getElementsByTagName('html').className


or



$('html').attr('class')


or



document.documentElement.className

More From » jquery

 Answers
9

I will go for:



document.documentElement.className;


Because doesn't involve any function's call, neither an additional layer like jquery. Ideally this one is the cleanest and the fastest.


[#84254] Friday, July 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sophiak

Total Points: 242
Total Questions: 90
Total Answers: 103

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
sophiak questions
;