Ok I have this code
$("#search-results-all").children(".search-result-item").length;
Now, all I want there is to select only the .search-result-item
elements that is only visible by using css attribute visibility:visible
. Now how can i make this possible?
PS Sorry I don't know what to type in Google so I can start searching.
UPDATE...
well it worked by doing something like this
$("#search-results-all").children(".search-result-item:visible").length;
thank you for the answers
The following?
$("#search-results-all > .search-result-item").filter(function() {
return $(this).css('visibility') == 'visible';
}).length;
Try this one:
$("#search-results-all .search-result-item").filter(function() {
return $(this).css('visibility') == 'visible';
});
:visible Selector
- Selects all elements that are visible.
$("#search-results-all").children(".search-result-item:visible").length;
or
$("#search-results-all").children(".search-result-item")).is(':visible');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.