3

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.

1

6 Answers 6

4

Try

$('*').removeAttr('style');

removeAttr

Sign up to request clarification or add additional context in comments.

1 Comment

@mplungjan yeah Tactical.People read it from here
1

Try this code:

$('*').removeAttr( "style" );

3 Comments

why posted answer exactly as mine ?
Nope. Found it on my own.
got the same answer early, Thanks anyway.
1

you could also do:

document.getElementsByTagName("*").removeAttribute("style")

Comments

1

for single element or group of element

use

$('elementselector').removeAttr('style');

for removing from entire page

use

$(*').removeAttr('style')

hope this helps...

Comments

1

With javascript:

document.getElementsByTagName("*").removeAttribute("style");

With jQuery (my personal choice):

$('*').removeAttr('style');

Comments

0

Yes, try

$('*').removeAttr( "style" );

as it will remove style attribute from each element of the page.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.