简体   繁体   English

在jQuery hasClass选择器回调?

[英]hasClass selector callback in jquery?

$('.box').hasClass('done').removeClass('hide');

I want to remove hide from .box which has class done, but it doesn't work with above code. 我想从已经完成类的.box中删除hide,但是上面的代码不起作用。 I'm very new to jquery. 我对jquery非常陌生。

只是追加类.done ,所以它只会针对具有两个元素boxdone类,然后删除hide从它使用类removeClass

$('.box.done').removeClass("hide");

As @AmitJoki answer you append class .done with .box class 作为@AmitJoki回答,您将.done类附加到.box类中

$('.box.done').removeClass('hide');

You can see Demo here. 您可以在此处查看演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM