如何选择高度大于200px的物品,并在var。
中记住它们var something = $('.myClass').withHeightMoreThan200px();
$('.myClass').each(function(){$(this).height(random(50,500)});
something.hide(); //even if after random change of height some new elements have now height >200px I want it to affect only those remembered before.
答案 0 :(得分:8)
使用filter()
:
var something = $('.myClass').filter(function(){
return $(this).height() > 200;
});