Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在一个变量中定义两个元素。
例如:
var replacer = $(".ir a") && $(".tk a");
var replacer = $('.ir a, .tk a');
或者:
var replacer = $('a').filter(function(){ return $(this).closest('.ir').length || $(this).closest('.tk').length });
参考:
closest()
filter()