Website under maintenance!

Hide the HTML Element Using JQuery

Posted on September 18, 2016 - Tags: ,

If you want to hide the element in the webpage, you can use .hide() with JQuery.


$(document).ready(function(){
$("div").hide();
});

The above code will hide all the ‘div’ element from your page. If you want to hide the element by id or class attributes, you can use ‘#content’ or ‘.content’ instead of ‘div’ tag. Here is an example:


$(".content").hide();

If you prefer to hide the element when user click on ‘button’, or other elements. You can use hide() method inside .click().


$("button").click(function() {
$("div").hide();
});

On the above example, when user clicks on the button