What is the inverse of: visible in jQuery?

4

The :visible selector in jQuery is used to search for an element when it is visible.

Example:

$(this).find('li:visible').addClass('color-red');

However, when trying to search for invisible elements, we do not have the :invisible

 $(':invisible') // Error: Syntax error, unrecognized expression: unsupported pseudo: invisible
  • What is the inverse of :visible in jQuery?

asked by anonymous 11.08.2015 / 14:29

2 answers

9

You can use :hidden , or pseudo :not() or .not() like this:

$('div:hidden').addClass('color-red');
// ou
$('div:not(:visible)').addClass('color-red');
// ou
$('div').not(':visible').addClass('color-red');

Example with :hidden : link
Example with :not(:visible) : link
Example with .not(':visible') : link

    
11.08.2015 / 14:34
3

I think it's hidden .

Example:

$(this).find('li:hidden').addClass('color-red');

link

    
11.08.2015 / 14:34