jQuery hide() with Examples

The hide() method in jQuery is used to hide selected elements.


The syntax is as follows −


Above, the parameter speed is the speed of the hide effect, whereas easing is the speed of the element in different points of the animation. The callback function is a function that executes after hide() method completes.


Let us now see an example to implement the jQuery hide() method  

 Live Demo

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<h2>Exam Info</h2>
<p>Examination begins on 24th December. The students are requested to submit project report before 15th December.</p>
<button class="btnhide">Hide</button>
<button class="btnshow">Display</button>


This will produce the following output −

Click the button “Hide” will hide the info −

Now, display again by clicking “Display” −