4

如何选择高度大于 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.
4

1 回答 1

8

使用filter()

var something = $('.myClass').filter(function(){
    return $(this).height() > 200;
});
于 2012-11-20T16:35:35.180 回答