jQuery hide()

Category: | May 23, 2021
Last Update: May 22, 2021

jQuery hide() method used to hide HTML element from the document based selection of element.

Syntax

$(selector).hide();
$(selector).hide(speed, callback);

speed parameter: It is an optional parameter and we can define speed of the delay. It accepts following types of values: ‘slow’, ‘fast’ or we can define it in milliseconds.

callback parameter: It is also an optional parameter and it accepts the function name that will be executed after hide() method completes.

Let’s have a look at following example:

$(document).ready(function(){  
    $("#my-button").click(function(){  
        $("div").hide();  
    });  
});

Category: