How can I show and hide an HTML element using jQuery?

To hide and show an HTML element using jQuery, use the hide and show() methods. Here, the <p> element is hidden and shown on button click,


Live Demo

<!DOCTYPE html>
<script src=""></script>

<p>This text  will show on clicking "Show element" button, and hide on clicking "Hide element" button.</p>

<button id="hidden">Hide element</button>
<button id="visible">Show element</button>


Updated on: 15-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started