SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Aug 28, 2007, 03:41 #1
- Join Date
- Feb 2004
- Location
- Grahamstown
- Posts
- 634
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Removing all the styles from an element
Hi
How does one remove all the styles associated with an emement.
eg: if you have
<div style="margin:solid 1px; color:white;background-color:black" ></div>
how would you clear this with javascript so that you have the equivalent of:
<div style=""></div>
-
Aug 28, 2007, 04:39 #2
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Use removeAttribute to remove the style attribute:
Code:thediv.removeAttribute('style');
Bookmarks