Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  60] [ 6]  / answers: 1 / hits: 17649  / 11 Years ago, wed, september 25, 2013, 12:00:00

I would like to modify a style which looks like:



<body class=theme1>


I would like to target this body's class and make that to just <body>. The problem is that, even though I would normally find elements using document.getElementById('someId') or by tagName in this case, I don't know how to find the target.


More From » html

 Answers
11

You can use document.body to get to it. To remove the class, you can use:



document.body.className = '';


This will change the contents of the class attribute to be the empty string, so it will remove all the classes the element might have.


[#75445] Tuesday, September 24, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anthonyw

Total Points: 589
Total Questions: 117
Total Answers: 117

Location: Dominican Republic
Member since Sun, Sep 4, 2022
2 Years ago
;