jQuery show() Method - CodingTag
×


jQuery show()

1361


Related Topics:

jQuery hide
jQuery effects

jQuery show

Syntax:

$(selector).show(speed, callback);

Parameter description:

  • speed: This parameter used to set the speed of showing. It can be "slow", "fast" or any time in milliseconds. It is optional.
  • callback: This represents a function that is executed after the completion of the show() method. It is also optional.

Example:

In this example, we show the paragraph at a slow speed after a click on it.

<html>
<head>
<title>jQuery Example</title>
<script type = "text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
</script>
<style>
.para{
background:pink;
padding:20px;
}
</style>
<script>
$(document).ready(function(){
$("p").hide();
$("button").click(function(){
$("p").show("slow");
});
});
</script>
</head>
<body>

<h2> jQuery show() method Example </h2>
<p class="para"> This is a paragraph. </p>
<button> CLICK HERE TO SHOW HIDDEN PARAGRAPH </button>
</body>
</html>

Output:

When you click on the button the hidden paragraph will show at a slow speed.

Example 2

In this example, we show the hidden paragraph at a fast speed after clicking on the button.

<html>
<head>
<title>jQuery Example</title>
<script type = "text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
</script>
<style>
.para{
background:pink;
padding:20px;
}
</style>
<script>
$(document).ready(function(){
$("p").hide();
$("button").click(function(){
$("p").show("fast");
});
});
</script>
</head>
<body>

<h2>jQuery show() method Example</h2>
<p class="para">This is a paragraph.</p>
<button>CLICK HERE TO SHOW HIDDEN PARAGRAPH</button>
</body>
</html>

Output:

When you click on the button, the hidden paragraph will show at a fast speed.



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments