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.
$("TagSelector").hide();
Now we are going to bulid our jQuery hide method concept using an example below.
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>
$(".mydiv").hide(1000);
Remember 1 Second = 1000.