How to delete elements from a jQuery collection?

-1

For example: I want to give .fadeOut() in all body , but with the exception of some element, such as a div. This can be done? How?

    
asked by anonymous 31.10.2016 / 02:03

1 answer

7

With jQuery you can use the not() function. It allows you to select a larger group of objects and remove the ones you do not want from them.

For example:

// seleciona todas as divs exceto as que tem a classe classe1
$('div').not('.classe1') 
// seleciona todas as '<option>' exceto as selecionadas
$('option').not(':selected')
    
31.10.2016 / 02:36