How can I count the number of items in div that are hidden?
Thanks in advance
How can I count the number of items in div that are hidden?
Thanks in advance
I think that
$("#someElement > *").filter(":hidden").size();
will work.
Updated: Added the '*'. Note that this will select the immediate children of #someElement
.
Direct children of someElement that are hidden:
$('#someElement > :hidden').length;
Any descendants of someElement that are hidden:
$('#someElement :hidden').length;
If you already have a jQuery object you can use it as the context:
var ele = $('#someElement');
$(':hidden', ele).length;