JavaScript Highlight Inline Styles

/ Published in: JavaScript
Save to your folder(s)

Puts a red border around anything with an inline style. Prefix with "javascript:" and paste into the address bar to run on a page directly, or run with a load event.

Copy this code and paste it in your HTML
  1. var elements = document.getElementsByTagName("*"); for (i = 0; i < elements.length; i++) { if (elements[i].getAttribute('style')) { var oldstyle = elements[i].getAttribute('style'); elements[i].setAttribute('style', oldstyle + "border: 1px solid #f00;"); } }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.