jQuery > Effects methods

.hide() - Hide particular element in jQuery

How to hide a particular element in jQuery?


To hide a particular html element, hide() method can be used.

<input type="button" id="btnHide" value="Hide" />

    <div id="divHide" style="height: 50px; width: 50px; background: red; left: 0px; 
position: absolute;"></div>

<script>
    $("#btnHide").click(function () {
        $("#divHide").hide("slow");
        // $("#divSlideDown").hide("slow", QueueIt);
    });
</script>

In the above code, on click of the button “btnHide”, the element “divHide” hides.

We can also specify a function name (to execute) in the second parameter of .hide() function. This function (in this case, QueueIt) will execute when the .hide() funciton completes its job.

 Views: 5092 | Post Order: 91



Write for us






Hosting Recommendations