开发者

No elements were found with the selector: ".highlight"

I appreciate jslint开发者_Python百科 telling me about my bad programming practices. How can I get rid of a warning message I get when I issue this command:

$('.highlight').removeClass();

when there are no elements with class="highlight".


try this

$('.highlight').each(function(){ $(this).removeClass(); });


try {
    $('.highlight').removeClass();
} catch (Exception) {
    // swallow. :)
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜