Example:
<!DOCTYPE html>
<html>
<head>
<title>jQuery hide() and show() Methods</title>
</head>
<body>
<p>I am here to toggle hide and show</p>
<button id="toggle-id">toggle</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#toggle-id").click(function() {
$("p").toggle();
});
});
</script>
</body>
</html>
Are you facing problems in understanding this?
download now