Remove all classes except one

前端 未结 6 1244
悲哀的现实
悲哀的现实 2020-12-08 06:37

Well, I know that with some jQuery actions, we can add a lot of classes to a particular div:

L

6条回答
  •  天涯浪人
    2020-12-08 06:53

    Use attr to directly set the class attribute to the specific value you want:

    $('#container div.cleanstate').attr('class','cleanstate');
    

提交回复
热议问题