How do I unset an element's CSS attribute using jQuery?

前端 未结 6 1753
北海茫月
北海茫月 2020-12-05 03:30

If I set a CSS value on a specific element using:

$(\'#element\').css(\'background-color\', \'#ccc\');

I want to be able to unset that elem

6条回答
  •  有刺的猬
    2020-12-05 04:18

    I think you can also do:

    $('#element').css('background-color', '');
    

    That's what I used to do a long time ago for the display property in plain-old-javascript to show/hide a field.

提交回复
热议问题