Método jQuery hide()

❮ Métodos de Efeito jQuery

Exemplo

Ocultar todos os elementos <p>:

$("button").click(function(){
  $("p").hide();
});

Definição e uso

O método hide() oculta os elementos selecionados.

Dica: Isso é semelhante à propriedade CSS display:none.

Nota : Elementos ocultos não serão exibidos (não afetam mais o layout da página).

Dica: Para mostrar elementos ocultos, veja o método show() .


Sintaxe

$(selector).hide(speed,easing,callback)

Parameter Description
speed Optional. Specifies the speed of the hide effect. Default value is 400 milliseconds

Possible values:

  • milliseconds
  • "slow"
  • "fast"
easing Optional. Specifies the speed of the element in different points of the animation. Default value is "swing"

Possible values:

  • "swing" - moves slower at the beginning/end, but faster in the middle
  • "linear" - moves in a constant speed
Tip: More easing functions are available in external plugins
callback Optional. A function to be executed after the hide() method is completed

To learn more about callback, visit our jQuery Callback chapter


Experimente você mesmo - Exemplos


Como usar o parâmetro speed ao ocultar/mostrar um elemento.


Como usar o parâmetro callback ao ocultar/mostrar um elemento.


❮ Métodos de Efeito jQuery