.hide()

Published Aug 4, 2022Updated Aug 4, 2022
Contribute to Docs

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();
});

All contributors

Looking to contribute?

Learn JavaScript on Codecademy