How to remove css property in jQuery

前端 未结 10 2002
逝去的感伤
逝去的感伤 2020-12-04 07:48
if(prev_clicked)
{   
    $(\"#accordion li a.category\").css(\'background-image\', \'url(\"img/off_all_channel.png\")\');                    
    $(\"#accordion li          


        
10条回答
  •  醉话见心
    2020-12-04 07:51

    You can use .css() to remove css property as well, like this:

    $(".icha0").css("background-color","");
    $(".icha0").css("opacity","");
    

    As mentioned in the jquery documentation:

    Setting the value of a style property to an empty string — e.g. $('#mydiv').css('color', '') — removes that property from an element if it has already been directly applied,

提交回复
热议问题