How to reset the style properties to their CSS def

2020-02-01 06:55发布

On a php generated page there are several elements like this:

<td class="defaultTDStyle" style="color:userDefinedCustomColor" id="myTDId"></td>

So there is a default style and I apply several extra styles that override the style defined in the CSS.

Is there a way to remove these added styles from javascript? It seems the obj.style.color="default" and obj.style.color="auto" not works. How can I reset the color to the CSS default from javascript?

2条回答
贼婆χ
2楼-- · 2020-02-01 07:19

Set the style property values to the empty string:

 obj.style.color = "";
查看更多
小情绪 Triste *
3楼-- · 2020-02-01 07:33

If recollection serves, obj.style.color="" should work... I don't know if it's right though.

查看更多
登录 后发表回答