Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select all elements with height bigger than given

How to select items with height bigger then 200px and remember them inside 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.
like image 756
user1785870 Avatar asked Feb 18 '23 10:02

user1785870


1 Answers

Use filter():

var something = $('.myClass').filter(function(){
    return $(this).height() > 200;
});
like image 189
Adriano Carneiro Avatar answered Feb 21 '23 03:02

Adriano Carneiro