jQuery .fadeOut() Hide Elements by Fading Out

Beginner
7 min read
Updated: Oct 2026
5 examples
Live preview

What Is .fadeOut()?

.fadeOut() (since jQuery 1.0) hides matched elements by fading them to transparent (opacity 0). When opacity reaches 0, display is set to none so the element leaves the layout. Returns the jQuery object for chaining.

Remember
$("#book").fadeOut();                    // default 400 ms
$("#book").fadeOut("slow", function () { /* done */ });
$("#panel").fadeOut(600, "linear");

// Fades opacity → 0 · then display: none
// Unlike .fadeTo() — that does not hide
NeedUse
Smooth hide to transparent$el.fadeOut()
Instant hide.hide()
Fade in / reveal.fadeIn()
Fade to a partial opacity.fadeTo()
Toggle fade either way.fadeToggle()

How to Use .fadeOut()

Select a visible element, call .fadeOut() from a click (or other) handler, optionally pass duration, easing, or a callback.

  1. Select the target ($("#book")).
  2. Ensure it is visible (already shown, or call .show() first).
  3. On a user action, call .fadeOut() (optional duration / easing / complete).
  4. jQuery animates opacity to 0, then sets display: none.
  5. For spam clicks, chain .stop(true, true) before .fadeOut().
PieceRequired?Role
Matched setYesVisible elements to hide
durationNoDefault 400; also "fast" (200) / "slow" (600)
easingNoDefault "swing"; built-in also "linear" (since 1.4.3)
completeNoRuns once per matched element when its fade ends
Return value—jQuery object (chainable)

Pseudocode

Pseudocode
call $(elements).fadeOut(duration?, easing?, complete?)

for each matched element:
    if element is already hidden:
        skip (no unnecessary DOM work)
    else:
        animate opacity → 0 over duration
        set display: none

    if complete was provided:
        call complete once for this element
        (this = the DOM element)

return the jQuery set for chaining

Cheat Sheet

Keep these facts handy while building fade exits.

TopicDetail
Syntax.fadeOut([duration] [, easing] [, complete])
Options form.fadeOut({ duration, easing, complete, … })
SincejQuery 1.0 · easing arg since 1.4.3
Default duration400 ms
Presets"fast" = 200 · "slow" = 600
Easingswing (default) · linear
After fadedisplay: none (leaves layout)
CallbackOnce per element · use .promise() for “all done”
Rapid clicks$el.stop(true, true).fadeOut()

Live Preview

Click Run to fadeOut the sample panel. Change duration with the chips.

This paragraph fades out with .fadeOut().

Reset shows the panel again so you can fade it out. Each Run starts from visible.

Result
Ready — click Run to fadeOut.

jQuery Examples

Short, copy-ready snippets. Open DevTools, or use Try It Yourself for a live editor.

Example 1 — Basic Slow Hide

From the jQuery docs: fade out a visible element on click with a complete callback.

jQuery
$("#clickme").on("click", function () {
  $("#book").fadeOut("slow", function () {
    // Animation complete.
  });
});
Try It Yourself

How It Works

  1. Visible start. #book begins shown on the page.
  2. Click. The handler calls .fadeOut("slow", …).
  3. Fade + hide. Opacity tweens to 0; then display: none.
  4. Callback. Fires once for that element when done.

Example 2 — All Paragraphs Fade Out

Official demo: clicking any paragraph fades out every p together.

jQuery
$("p").on("click", function () {
  $("p").fadeOut("slow");
});
Try It Yourself

How It Works

  1. Bind. Every p listens for click.
  2. Set. The handler selects all p elements, not just the clicked one.
  3. fadeOut. Each paragraph fades over 600 ms.
  4. Layout. After opacity hits 0, they leave the flow.

Example 3 — Fade Out Then Remove

Official pattern: fade a clicked span, log its text, then remove it from the DOM.

jQuery
$("span").not("#log").on("click", function () {
  $(this).fadeOut(1000, function () {
    $("#log").text(" '" + $(this).text() + "' has faded!");
    $(this).remove();
  });
});
Try It Yourself

How It Works

  1. Target. Only content spans (not the log) are clickable.
  2. fadeOut. That span fades over 1 second.
  3. Complete. Reads the text, updates the log, then .remove().
  4. Cleanup. The node is gone — not just hidden.

Example 4 — Linear vs Swing

Official demo: same duration, different easing — compare constant vs default swing pace.

jQuery
$("#btn1").on("click", function () {
  function complete() {
    $("
").text(this.id + " done").appendTo("#log"); } $("#box1").fadeOut(1600, "linear", complete); $("#box2").fadeOut(1600, complete); }); $("#btn2").on("click", function () { $("div.box").show(); $("#log").empty(); });
Try It Yourself

How It Works

  1. Shared duration. Both boxes use 1600 ms.
  2. linear. #box1 keeps a constant pace.
  3. swing. #box2 uses the default easing curve.
  4. Reset. .show() brings both boxes back.

Example 5 — Dismiss a Toast

Fade out a notification, then remove it — a common UI dismiss pattern.

jQuery
$("#dismiss").on("click", function () {
  $("#toast").fadeOut(400, function () {
    $(this).remove();
  });
});
Try It Yourself

How It Works

  1. fadeOut. Soft exit over 400 ms.
  2. Complete. Runs after display: none is applied.
  3. remove. Deletes the element so it cannot reappear accidentally.
  4. Show again. Recreate the toast node if you need another notice.

Edge Cases & Pitfalls

CaseWhat happensFix
Already hiddenNo animation (skipped).show() first, or only call when visible
Need partial opacity.fadeOut() goes to 0 and hidesUse .fadeTo()
Spam clicksQueued fades stack up.stop(true, true) before .fadeOut()
One callback for many elementsComplete fires per elementUse .promise().done()
jQuery.fx.offDuration becomes 0Respect reduced-motion / accessibility settings

Browser Support

.fadeOut() has been part of jQuery since 1.0 (easing argument since 1.4.3). It works in every browser that runs your loaded jQuery version.

✓ Stable · jQuery 1.0+

jQuery .fadeOut()

Supported across jQuery 1.x, 2.x, and 3.x. Prefer a current jQuery 3.x build. Call it on visible elements for a clear exit.

100% With jQuery
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
.fadeOut() Universal

Bottom line: Safe for everyday UI dismissals. Guard rapid clicks with .stop(true, true), and respect jQuery.fx.off for reduced motion.

Performance Notes

ApproachCostBest for
One element fadeOutCheapToasts, panels, alerts
Many elements at onceMore paint workKeep sets small; prefer one container
Queued spam clicksWasted framesAlways .stop(true, true) on busy buttons

Opacity fades are inexpensive for a few elements. Cost climbs with large sets or stacked queues — stop before fade, and prefer fading one wrapper over dozens of children.

Key Takeaways

  • Role: fade to transparent + display: none — since jQuery 1.0.
  • Call: $el.fadeOut() — default 400 ms; optional easing + complete.
  • vs fadeTo: .fadeOut() hides · .fadeTo() does not.
  • Guard: .stop(true, true) before fade on busy buttons.

One line: .fadeOut() hides a visible element by fading opacity to 0 — the smooth counterpart to .hide().

Frequently Asked Questions

.fadeOut() hides matched elements by fading them to transparent. It animates opacity toward 0, then sets display to none so the element no longer affects page layout. Use it for a smooth exit instead of an instant .hide().
1) .fadeOut([duration] [, complete]) — optional duration and completion callback. 2) .fadeOut(options) — an options object with duration, easing, queue, step, progress, and Promise-style callbacks. 3) .fadeOut([duration] [, easing] [, complete]) — positional easing since jQuery 1.4.3.
.hide() removes elements instantly with no transition. .fadeIn() is the opposite reveal — unhides and fades to full opacity. .fadeTo() animates to a target opacity but does not hide. .fadeOut() both fades to transparent and sets display:none.
Duration is in milliseconds. Default is 400 ms when omitted. The strings "fast" (200 ms) and "slow" (600 ms) map to preset speeds, the same as other jQuery effect methods.
Once per matched element when that element’s fade finishes — not once for the whole set. Inside the callback, this is the DOM element. Use .promise().done() when you need a single callback after every element completes.
No. To avoid unnecessary DOM work, .fadeOut() will not hide an element that is already considered hidden (typically display:none). Calling it on hidden content produces little or no visible effect.

Next: .fadeTo() Method

Animate to a specific opacity without setting display:none — fine-grained fade control.

.fadeTo() tutorial →

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.

10 people found this page helpful