How to remove css property in jQuery

前端 未结 10 2003
逝去的感伤
逝去的感伤 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 08:07

    This is literally a copy paste from this answer, and I use it to clear CSS style that I added with jQuery in a previously executed function.

    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');
    

    OR by ID:

    $('#idName').removeAttr('style');
    

提交回复
热议问题