javascript - How do I remove all style tags without jquery -
its simple, removes style tags on code below want to
$('*').removeattr('style');
now need exact same thing without jquery, since whole code written without jquery, don't want include library simple task
among other things, tried far won't work
document.getelementsbytagname('*').style.csstext = null; document.getelementsbytagname('*').style.csstext = ""; document.getelementsbytagname('*').removeattribute("style");
solution
var allstyles= document.getelementsbytagname('*'); for(var a=0; a<allstyles.length; a++) { allstyles[a].removeattribute("style"); }
the document.getelementsbytagname('*')
returns array. need go through each item individually in loop , remove attribute.
an example of such loop be
var elements = document.getelementsbytagname('*'); (var = 0; < elements.length; i++) elements[i].removeattribute("style");
Comments
Post a Comment