hide() Method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:hide


The hide() method hides the selected elements.


$(selector).hide(speed, easing, callback);
Parameter Require Description Value
speed Optional. speed of the hide effect. Default value is 400 milliseconds, Possible values: milliseconds "slow" "fast"
easingOptional. speed of the element in different points of the animation. Default value is "swing"
callback Optional. A function to be executed after the hide() method is completedTo learn more about callback, visit our jQuery Callback chapter

Possible easing values:

  • "swing" - slower at the beginning/end, but faster in the middle
  • "linear" - in a constant speed

The following code shows how to Hide all <p> elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    });//from ww w . j av  a  2s  .c  o  m

<p>This is a paragraph.</p>

<button class="btn1">Hide</button>
<button class="btn2">Show</button>


Related Tutorials