The hide() method hides the selected elements.so we can say that This is similar to the CSS property display: none. And To show hidden elements again, show() method.
Note: Hidden elements will not be displayed at all (no longer affects the layout of the page).
Syntex:
$(selector).hide(speed,easing,callback)
|
Example:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
$("p").hide();
});
$(".btn2").click(function(){
$("p").show();
});
});
</script>
</head>
<body>
<p>This is a paragraph element .</p>
<button class="btn1">Hide paragraph</button>
<button class="btn2">Show paragraph</button>
</body>
</html>
|