开发者

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

开发者 https://www.devze.com 2023-02-01 21:49 出处:网络
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:

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

精彩评论

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