About deleting css Styles

recently, the write plug-in encountered such a problem

original dom

hello world

after adding css with JavaScript

<p style="color:-sharpFF0000">hello world

I want to achieve the effect that when I add styles dynamically and then delete them, I don"t think the color property is set to color:none; but delete the styles I added dynamically, restore them as they are, and do not affect the other attributes in style . I don"t know what the solution is

.

hello world

May.22,2021

< del > dom.style.color= "; < / del >

< hr >

2019.1.5 UPDATE

A more standardized method should be

dom.style.removeProperty("color");

Resources

CSSStyleDeclaration.removeProperty () | MDN


can't add classes with js, then delete class


write a class, to add to the element and delete the class when the class, is deleted.


delete dom.style.color should be fine.

Menu