Reset element color to default stylesheet color (jQuery, JavaScript)

前端 未结 3 921
囚心锁ツ
囚心锁ツ 2021-02-18 13:35

I need to be able to reset an input field back to its original color after it has been possibly changed via javascript to a different value. The problem is I do not want to har

3条回答
  •  面向向阳花
    2021-02-18 14:17

    There's no better way. It's the standard way.

    Basically, there's no way to delete a CSS attribute from the style property of DOM elements. So all you can do is set the attribute value to empty and let CSS do its job of reverting back to the stylesheet.

提交回复
热议问题