.hide()

The .hide() method hides an HTML element.

Syntax

$(selector).hide(speed, callback);
  • selector: Specifies the elements that will be hidden.
  • speed(optional): Can be “slow” or “fast” or the number of milliseconds.
  • callback(optional): A function that is called once the element is hidden.

Example

The following jQuery code will hide the element selected with #hide when it is clicked:

$("#hide").click(function() {
$("#hide").hide();
});

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn JavaScript on Codecademy