jQuery show()
The jQuery show() method is used to display the selected elements.
Syntax
$(selector).show(speed, callback);
- selector: Specifies the element(s) to display.
- speed (optional): Defines the duration of the show animation (e.g., slow, fast, or milliseconds).
- callback (optional): A function to execute after the show animation is complete.
<!DOCTYPE html>
<html>
<head>
<title>jQuery show() Example</title>
<script>
$(document).ready(function(){
$("#showButton").click(function(){
$("#text").show("slow", function(){
alert("The text is now
visible.");
});
});
});
</script>
</head>
<body>
<p id="text" style="display:none;">This is some hidden text that
will be shown.</p>
<button id="showButton">Show Text</button>
</body>
</html>