How can I erase all inline styles with javascript and leave only the styles specified in the css style sheet?

前端 未结 7 721
一整个雨季
一整个雨季 2020-12-02 14:53

If I have the following in my html:

And this in my c

7条回答
  •  天涯浪人
    2020-12-02 15:44

    If you need to just empty the style of an element then:
    element.style.cssText = null;
    This should do good. Hope it helps!

提交回复
热议问题