How to use hide() method on button click using jQuery ? Last Updated : 10 Aug, 2021 Comments Improve Suggest changes Like Article Like Report jQuery has a lot of handy methods to get the work done easily. In this article, we will discuss one of them which is the hide() method. We can use this method for various purposes on our webpage and get an efficient result. The very first step will be creating an HTML file and link the jQuery library file via CDN. jQuery CDN Link: <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script> jQuery hide() method: This method is used for hiding the web elements. Example 1: Create an HTML file and add the following code to it. HTML <!DOCTYPE html> <html lang="en"> <head> <!-- jQuery CDN link. --> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"> </script> </head> <body> <button id="btn">Hide</button> <p><b>GeeksforGeeks</b></p> <!-- Using hide() method to hide <p/> element. --> <script> $(document).ready(function () { $("#btn").click(function () { $("p").hide(); }); }); </script> </body> </html> Output: Hide p element Example 2: We can use the hide() method to hide an image. HTML <!DOCTYPE html> <html lang="en"> <head> <!-- jQuery CDN link. --> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"> </script> </head> <body> <img id="image" src= "https://media.geeksforgeeks.org/wp-content/uploads/20210805112556/gfgImage.png" alt=""/> <button id="btn" style="padding-left: 10px; margin-left: 30px"> Hide </button> <!-- Using hide() method to hide an image.--> <script> $(document).ready(function () { $("#btn").click(function () { $("#image").hide(); }); }); </script> </body> </html> Output: Hide Image Example 3: The hide() method can also be used to hide any geometrical shape. HTML <!DOCTYPE html> <html lang="en"> <head> <!-- jQuery CDN link. --> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"> </script> </head> <body> <div id="shape" style="height:100px; width:100px; background-color:green; border-radius:00%;margin:10px;"> </div> <button id="btn" style="margin:10px;">Hide Shape</button> <!-- Using hide() method to hide a shape. --> <script> $(document).ready(function () { $("#btn").click(function () { $("#shape").hide(); }); }); </script> </body> </html> Output: Hide shape Comment More infoAdvertise with us Next Article How to use hide() method on button click using jQuery ? I iamgaurav Follow Improve Article Tags : Web Technologies HTML JQuery jQuery-Methods jQuery-Questions +1 More Similar Reads How to hide/show an image on button click using jQuery ? In this article, we will see how we can hide or show any particular image in jQuery when a button gets clicked. This is quite easy to do with some lines of jQuery code. Before we jump to the topic, let's know which methods of jQuery will be used for this. So there is a method called show() and anoth 3 min read How to hide block of HTML code on a button click using jQuery ? In this article, we will learn how to hide a block of HTML code with a button click. We can do this by using the jQuery inbuilt hide() method. Let's briefly learn the functionality of this method. hide(): In CSS, we have a property display:none which basically hides the element. This hide() method i 2 min read How to use hide() method in jQuery ? The hide() method in jQuery is used for hiding the selected web elements. In this article, we will discuss the hide() method in detail. This method is generally used for effects or animation in jQuery. It also allows us to animate the behavior (transition) of hiding any specific element. Syntax:.hid 5 min read How to show/hide an element using jQuery ? We are given an element and the task is to to show/hide the element using jQuery. Below are the approaches to show/hide an element using jQuery:Table of ContentUsing css() methodsUsing show methodUsing Toggle methodApproach 1: Using css() methodsIt takes two parameters where the first parameter is t 3 min read How to make a Disable Buttons using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be making a Disable Button using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet 1 min read Like