jQuery Hide function method


jquery jQuery Hide function method Jquery Introduction

How to hide the HTML element using jQuery function?

It is very simple to turn the HTML element display off using jQuery function hide(). First We will select the HTML tag then we will apply the jQuery function hide.

Syntax of jQuery Hide function

$("TagSelector").hide(); Now we are going to bulid our jQuery hide method concept using an example below.

On button click hide the div with class="mydiv"

First we will get access the div with class="mydiv" with two parameter (" div #mydiv") because we want to hide the only HTML tag that have following characteristics. 1- Class equal to mydiv. 2- HTML tag name div.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button> Click Me </button> <div class="mydiv" >Welcome to CodingPk jQuery Tutorial. I want to hide on button Click </div> <script type="text/javascript"> $("button").click(function() { $(".mydiv").hide(); }); </script>

Output above Code jQuery Hide

Welcome to CodingPk jQuery Tutorial. I want to hide on button Click
Effect: You can Slowly Hide with passing the time parameter into the hide() function. For Example. $(".mydiv").hide(1000); Remember 1 Second = 1000.
jquery Jquery Introduction Chapter Next »