jQuery: How to count the number of elements which “display” isn't “none”?

前端 未结 3 470
野的像风
野的像风 2021-01-02 02:07

I use show() and hide() to show and hide rows in a table.

How could I count the number of non-hidden rows (more accurately, rows with

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 02:17

    Try this:

    $('tr:not([style*="display: none"])').length
    

    Example http://jsfiddle.net/infernalbadger/7LvD5/

提交回复
热议问题