Define show() method of jQuery in detail.

The jQuery show() method is used to show the hidden elements of HTML in the web document. Note that, the show method would not show elements which property are set to Hidden by visibility property, i.e. visibility: hidden in CSS.
The elements that are hidden by using the hide() method or with CSS property display: none; can be shown by using the show() method.

Syntax of jQuery show

Following is the syntax of show method
$(selector).show(speed,callback)
Where
Selector = This can be an HTML element like div, p, list etc.
Speed = This is an optional parameter with three possible values:
“slow”
“fast”
Value in milliseconds
Callback = after the jQuery show() method is executed, an optional callback function can be used.

Example of using show method

Following example shows how to use the show method. We have used a div element that contains a yellow line with text, which is hidden initially. As you click on the button the div element will be shown by using the show method.

<!DOCTYPE html>

<head>

<title>jQuery Testing</title>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
   <script type="text/javascript" language="javascript">
   $(document).ready(function() {
     $(".hidetext").click(function () {
     $(".text").show("slow")
  });
  });
   </script>
</head>
<body>
   <button class="hidetext">Show yellow line</button>
   <div class="text" style="background-color:yellow;display: none;">
     This is Yellow line!!
   </div>
</body>
</html>

Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*