jQuery .fadeOut() Hide Elements by Fading Out

Beginner
5 min read
Updated: Nov 2026
3 examples
Effects

Definition

.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.

Syntax

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

jQuery
$("#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
CallWhat it does
.fadeOut() Hide Elements by Fading OutLearn jQuery .fadeOut(): hide visible elements by animating opacity to transparent since 1.0, duration and easing defaults, per-element callbacks, display:none after fade, and compare with hide, fadeIn, fadeTo, and fadeToggle.

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

Parameters

ParameterDescription
Step 1Select the target ($("#book")).
Step 2Ensure it is visible (already shown, or call .show() first).
Step 3On a user action, call .fadeOut() (optional duration / easing / complete).

Return Value

Return ValueDescription
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

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.

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.

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().

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() Animate to a Target Opacity

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

.fadeTo() Animate to a Target Opacity 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.

10 people found this page helpful