Skip to content

Instantly share code, notes, and snippets.

@rmehner
Created September 7, 2010 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmehner/568212 to your computer and use it in GitHub Desktop.
Save rmehner/568212 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Kill all style Attributes</title>
</head>
<body style="color: red;">
<p style="border: 2px solid black;">
Foo
</p>
</body>
<script>
// works on FF 3.5, Webkit and IE 8 (no idea if it's also working for IE < 8)
for (var i = 0, elements = document.querySelectorAll('[style]'); i < elements.length; i++) {
elements.item(i).removeAttribute('style');
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment