Example 1 — Instant Hide
Hide paragraphs immediately with no animation.
$("p").hide(); How It Works
- Select.
$("p")matches every paragraph. - Save. Each element’s current
displayis cached. - Hide.
displaybecomesnonewith no animation.

.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().
Start with these common calls. Keep them short and readable.
$(".target").hide() // instant
$("p").hide("slow") // 600ms animation
$("#box").hide(400, function () { // ms + complete
// this = current element
});
// "fast" = 200ms · default animated duration = 400ms | Call | What 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.
| Parameter | Description |
|---|---|
| Step 1 | Select the element(s) to hide. |
| Step 2 | Call .hide() for an instant hide, or pass a duration / options. |
| Step 3 | Optionally pass a complete callback (runs once per element). |
| Return Value | Description |
|---|---|
| jQuery object | Most setters and traversing helpers return the jQuery collection so you can chain more methods. |
Hide paragraphs immediately with no animation.
$("p").hide(); $("p") matches every paragraph.display is cached.display becomes none with no animation."slow"Animate the hide over about 600 milliseconds.
$("p").hide("slow"); "slow" means 600ms.display: none.Prove that saved display is restored correctly.
$("#box").hide();
$("#box").show();
// display restored from jQuery's cache none.Restore hidden elements and the display mode jQuery saved for you.
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
8 people found this page helpful