querySelector() where display is not none

前端 未结 3 1203
独厮守ぢ
独厮守ぢ 2021-02-20 11:29

I have a long list of

  • items I need to filter. I want the visible ones. Here\'s an example hidden one:

  • 3条回答
    •  借酒劲吻你
      2021-02-20 12:35

      Try this:

      document.querySelectorAll('.newSearchResultsList li:hidden')
      

      or (EDIT: Based on style attribute.)

      document.querySelectorAll('.newSearchResultsList li[style*="display:none"]');
      

      or opossite

      document.querySelectorAll('.newSearchResultsList li:not([style*="display:none"])');
      

    提交回复
    热议问题