jQuery show() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
DOM

Definition

.show() displays matched elements (since jQuery 1.0). With no arguments it is instant and restores the display value saved by .hide() — so inline, block, flex, and others come back correctly. With a duration it becomes an animation.

Syntax

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

jQuery
$(".target").show()                 // instant
$("p").show("slow")                 // 600ms animation
$("#box").show(200, function () {}) // duration + complete

// Not the same as always forcing block:
// .css("display", "block")  vs  restore saved display

// Pair with the opposite:
$(".panel").hide()
$(".panel").show()
CallWhat it does
show()Learn jQuery .show(): reveal hidden elements instantly or with animation, restore saved display values, durations, callbacks, examples, pitfalls, 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) you want to reveal.
Step 2Call .show() for an instant reveal, or pass a duration / options.
Step 3Optionally add a complete callback (runs once per matched 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 .show()

Reveal a hidden element immediately with no animation.

jQuery
// <div id="box" style="display:none">Hello</div>
$("#box").show();
Try It Yourself

How It Works

  1. Hidden start. The box begins with display: none.
  2. No args. Instant reveal — no duration.
  3. Display restored. The element reappears in the document flow.

Example 2 — Official Demo: show("slow")

Animate hidden paragraphs into view over 600 milliseconds.

jQuery
// <p style="display:none">Hello</p>
// <p style="display:none">World</p>
$("p").show("slow");
Try It Yourself

How It Works

  1. Duration. "slow" means 600ms.
  2. Animate. Width, height, and opacity change together.
  3. Then visible. Final display is restored.

Example 3 — Complete Callback

Run code after the show animation finishes (once per element).

jQuery
$("#msg").show(400, function () {
  $(this).text("Now visible");
});
Try It Yourself

How It Works

  1. Animate. 400ms show runs first.
  2. Callback. Fires when that element finishes.
  3. this. Inside the function, this is the DOM element.

Frequently Asked Questions

.show() displays matched elements. With no arguments it is instant and restores the display value saved by .hide() (or a sensible default). With a duration or options it animates width, height, and opacity. Returns the jQuery collection. Available since jQuery 1.0.
.css('display', 'block') always forces block. .show() restores the saved display — so an inline span becomes inline again. Prefer .show() after .hide() for correct layout.
.hide() sets display: none and saves the old display. .show() reverses that. Pair them for menus, modals, and panels.
Yes. Pass milliseconds, 'slow' (600ms), or 'fast' (200ms). You can also pass easing (1.4.3+), an options object, and a complete callback (once per matched element).
No. Prefer class toggles with .addClass() / .removeClass() / .toggleClass(). Forcing style with !important overwrites the style attribute and is usually a last resort.
Set jQuery.fx.off = true. All effects, including .show(), then run with zero duration. Useful for tests or reduced motion.

Next: size() Method — Count Matched Elements (Deprecated)

Learn the legacy length helper and what to use instead.

size() Method — Count Matched Elements (Deprecated) 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.

9 people found this page helpful