JQuery: Nested Visibility

I have a table with several <tbody> elements. In this case, some <tbody> elements are visible and some are hidden, and I need to select only visible ones.
I am using jQuery :visible selector.

Now the problem is that I need to complete this task before I show the table, AKA, while the table is hidden and the :visible selector does not work.

How can I select the visible <tbody> elements while the table is hidden?

Thanks.

+4
source share
1 answer

You can call .filter :

 $('tbody').filter(function() { return $(this).css('display') !== 'none'; }) 
+5
source

Source: https://habr.com/ru/post/1312763/


All Articles