Reputation: 3765
Need to disable all inline styling of every DOM elements from a html document.
Saw some solution to override inline styles but i need to clear all inline styling. Also may be done with the code formatting but not interested with that also,
Is there a way to do this with JavaScript.
Upvotes: 3
Views: 186
Reputation: 74738
With javascript:
document.getElementsByTagName("*").removeAttribute("style");
With jQuery (my personal choice
):
$('*').removeAttr('style');
Upvotes: 1
Reputation: 2709
Yes, try
$('*').removeAttr( "style" );
as it will remove style attribute from each element of the page.
Upvotes: 0
Reputation: 703
for single element or group of element
use
$('elementselector').removeAttr('style');
for removing from entire page
use
$(*').removeAttr('style')
hope this helps...
Upvotes: 1
Reputation: 100175
you could also do:
document.getElementsByTagName("*").removeAttribute("style")
Upvotes: 1