pstein Posted March 31, 2017 Share Posted March 31, 2017 Assume I have a web page which contains multiple elements similar to <span style="font-size: medium;">....</span> How can I remove the "style=" attribute for all the elements? Overwriting with a neutral value and !important would be acceptable as well. The element <span> itself should still persist Peter Link to comment Share on other sites More sharing options...
dsonesuk Posted March 31, 2017 Share Posted March 31, 2017 Requires JavaScript, drawback JavaScript must be enabled, google will only refer to non JavaScript manipulated site. Better solution is to remove the attribute manually, place styling in external css file. Link to comment Share on other sites More sharing options...
rockey91 Posted March 31, 2017 Share Posted March 31, 2017 Using jquery, - $('*').removeAttr('style'); or - $('span, div, ...').removeAttr('style'); // Specify the list of tag names for which style attribute to be removed. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now