How to remove css property in jQuery

前端 未结 10 1992
逝去的感伤
逝去的感伤 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:56

    To remove the in-line CSS property use:

    $('.className').css({propertyName: ''});
    

    To remove the whole in-line style of an element use:

    $('.className').removeAttr('style');
    

    I've also found this suggestion to remove the CSS property from styles (separate file) use:

    $('.className').style.propertyName = '';

    BUT I couldn't get it to work at all, so I'm putting it here just FYI.

提交回复
热议问题