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. :)
}
精彩评论