jQuery .hide() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
DOM

Definition

.hide() hides matched elements with display: none (since jQuery 1.0). Instant with no args; with a duration it becomes an animation. The previous display is saved for .show().

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$(".target").hide()                 // instant
$("p").hide("slow")                 // 600ms animation
$("#box").hide(400, function () {   // ms + complete
  // this = current element
});

// "fast" = 200ms · default animated duration = 400ms
CallWhat it does
.hide()Learn jQuery .hide(): hide elements instantly or with animation, saved display for show(), slow/fast durations, callbacks, hide vs show vs css display, examples, and FAQs.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Select the element(s) to hide.
Step 2Call .hide() for an instant hide, or pass a duration / options.
Step 3Optionally pass a complete callback (runs once per element).

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

Example 1 — Instant Hide

Hide paragraphs immediately with no animation.

jQuery
$("p").hide();
Try It Yourself

How It Works

  1. Select. $("p") matches every paragraph.
  2. Save. Each element’s current display is cached.
  3. Hide. display becomes none with no animation.

Example 2 — Hide With "slow"

Animate the hide over about 600 milliseconds.

jQuery
$("p").hide("slow");
Try It Yourself

How It Works

  1. Duration. "slow" means 600ms.
  2. Animate. Width, height, and opacity move toward 0.
  3. Finish. jQuery sets display: none.

Example 3 — Hide Then Show

Prove that saved display is restored correctly.

jQuery
$("#box").hide();
$("#box").show();
// display restored from jQuery's cache
Try It Yourself

How It Works

  1. Hide. Caches display and sets none.
  2. Show. Reads the cache and restores that value.
  3. Why it matters. Inline stays inline — not forced to block.

Frequently Asked Questions

.hide() hides matched elements with display: none. With no arguments it is instant. jQuery saves the previous display value so .show() can restore inline, block, flex, and other modes. Returns the jQuery collection for chaining. Available since jQuery 1.0.
.css("display", "none") only sets CSS. .hide() also stores the previous display in jQuery’s cache so .show() can restore it correctly.
Yes. Pass a duration in ms, or "slow" (600) / "fast" (200). jQuery animates width, height, and opacity, then sets display to none. You can also pass easing, an options object, or a complete callback.
No. Hidden elements stay in the document; they just leave layout. Use .remove() or .detach() to take nodes out of the DOM.
.hide() makes elements invisible and removes them from layout. .show() reverses that and restores the saved display value.
Set jQuery.fx.off = true. All effects, including .hide(), run with zero duration. Useful for tests or reduced motion.
Once per matched element when that element’s animation finishes — not once for the whole set.

Next: show() Method — Display Matched Elements

Restore hidden elements and the display mode jQuery saved for you.

show() Method — Display Matched Elements tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful