The show() Method in jQuery is used to display the hidden and selected elements.
Note: This method display the hidden elements which are using CSS display: none property. The elements are not visible whose visibility is hidden.
Syntax:
$(selector).show( speed, easing, callback )
Parameters:This method accepts three parameters as mentioned above and described below:
- Speed: It is an optional parameter and used to specify the speed of the fading effect. The default value of speed is 400 millisecond. The possible value of speed are:
- milliseconds
- “slow”
- “fast”
- Easing: It is an optional parameter and used to specify the speed of element to different points of animation. The default value of easing is “swing”. The possible value of easing are:
- “swing”
- “linear”
- callback: It is optional parameter. The callback function is executed after show() method is completed.
Below examples illustrate the show() method in jQuery:
Example 1: This example showing display: none content with given speed.
<!DOCTYPE html> <html> <head> <title> jQuery Effect show() Method </title> <style> #Outer { border: 1px solid black; padding-top: 40px; height: 140px; background: green; display: none; } </style> <script src= </script> </head> <body style = "text-align:center;"> <div id= "Outer"> <h1 style = "color:white;" > GeeksForGeeks </h1> </div><br> <button id = "btn"> Show </button> <!-- Script to show display:none content --> <script> $(document).ready(function() { $("#btn").click(function() { $("#Outer").show(1000); }); }); </script> </body> </html> |
Output:
- Before click on the button:
- After click on the button:
Example 2: This example showing display: none content with swing easing value.
<!DOCTYPE html> <html> <head> <title> jQuery Effect show() Method </title> <style> #Outer { border: 1px solid black; padding-top: 40px; height: 140px; background: green; display: none; } </style> <script src= </script> </head> <body style = "text-align:center;"> <div id= "Outer"> <h1 style = "color:white;" > GeeksForGeeks </h1> </div><br> <button id = "btn"> Show </button> <!-- Script to show display: none content with swing easing --> <script> $(document).ready(function() { $("#btn").click(function() { $("#Outer").show("swing"); }); }); </script> </body> </html> |
Output:
- Before click on the button:
- After click on the button:
Recommended Posts:
- How to create Show More and Show Less functionality for hiding text using JavaScript ?
- jQuery UI | show() Method
- jQuery | Hide/Show, Toggle and Fading methods with Examples
- How to show contents of selected row of a table in Bootstrap model using jQuery ?
- How to show/hide div element depending multiple values using Bootstrap and jQuery ?
- jQuery | Effect fadeOut() Method
- jQuery UI | effect() Method
- How to create slide left and right toggle effect using jQuery?
- How to use Explode effect in jQuery ?
- How to create followspot effect using HTML CSS and jQuery ?
- AngularJS | ng-show Directive
- Show and hide password using JavaScript
- Hide or show HTML elements using visibility property in JavaScript
- How to display icon next to show/hide text on button?
- p5.js | show() Function
- How to Show and Hide div elements using radio buttons?
- How to Show and Hide div elements using Checkboxes ?
- How to show Page Loading div until the page has finished loading?
- How to hide or show one record from an ng-repeat within a table based on ng-click?
- How to show a span element for each rows clicked in AngularJS?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

