jQuery .dequeue() Method

Beginner
6 min read
Updated: Oct 2026
4 examples
Live preview

What Is jQuery.dequeue()?

jQuery.dequeue(element [, queueName]) (alias $.dequeue) removes the next function from an element’s queue and runs it (added in jQuery 1.3). Default queue name is "fx".

Remember
$.dequeue(element [, queueName])  → undefined

// Inside a custom .queue() step:
.queue(function () {
  $(this).toggleClass("done");
  $.dequeue(this);          // continue the fx queue
})

// Everyday alternative:
$(this).dequeue()
// or modern:
.queue(function (next) { …; next(); })
NeedUse
Low-level continue$.dequeue(elem)
Everyday continue$(elem).dequeue()
Add / inspect queue$.queue() / .queue()

How to Use jQuery.dequeue()

Advance a paused queue after your custom step finishes.

  1. Build a chain with .animate() / .fadeOut() and a custom .queue() step.
  2. Inside that step, do your work (toggleClass, change text, etc.).
  3. Call $.dequeue(this) (or $(this).dequeue() / next()) to continue.
  4. For a named queue, pass the same name: $.dequeue(el, "tasks").
PieceRequired?Role
elementYesRaw DOM element holding the queue
queueNameNoDefaults to "fx"
Return—undefined (not chainable)

Pseudocode

Pseudocode
function dequeue(element, queueName = "fx"):
    fn = remove next function from element.queues[queueName]
    if fn exists:
        run fn with element as this
        // fn should eventually call dequeue again (or next())

// Typical animation chain:
animate A
queue step:
    do custom work
    $.dequeue(this)     // unlock remaining steps
animate B

Cheat Sheet

Keep these facts handy while continuing jQuery queues.

TopicDetail
SyntaxjQuery.dequeue(element [, queueName])
SincejQuery 1.3
Default queue"fx" (effects)
Twin method.dequeue()
PartnerjQuery.queue()
Modern style.queue(function (next) { …; next(); })
Clear waiting.clearQueue()

Live Preview

Run a short fadeOut → custom step → $.dequeue → fadeIn chain.

Demo box: Ready

Result
Pick a mode and click Run chain.

jQuery Examples

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

Example 1 — Official Pattern: Finish a Queue Step

Do work in .queue(), then call $.dequeue(this) so the chain continues.

jQuery
$("#box")
  .fadeOut(400)
  .queue(function () {
    $(this).text("Mid step");
    $.dequeue(this);
  })
  .fadeIn(400);
Try It Yourself

How It Works

  1. Fade out. First fx step hides the element.
  2. Custom step. Your queued function changes the text.
  3. Continue. $.dequeue(this) starts the next fx item.
  4. Fade in. The element appears again with the new text.

Example 2 — Missing Dequeue Stalls the Chain

Without a continue signal, later effects never run.

jQuery
// Stalls — fadeIn never runs:
$("#a").fadeOut(300).queue(function () {
  $(this).text("stuck");
  // forgot $.dequeue(this);
}).fadeIn(300);

// Fixed:
$("#b").fadeOut(300).queue(function () {
  $(this).text("ok");
  $.dequeue(this);
}).fadeIn(300);
Try It Yourself

How It Works

  1. Broken path. The queue function ends without continuing → later steps wait forever.
  2. Fixed path. $.dequeue(this) unlocks fadeIn.
  3. Symptom. Element disappears and never returns.
  4. Fix habit. Always end custom fx steps with dequeue / next.

Example 3 — Custom Queue Name

Pass the same name to $.queue and $.dequeue.

jQuery
var el = document.getElementById("box");

$.queue(el, "tasks", function (next) {
  $(el).text("Step 1");
  setTimeout(next, 400);
});
$.queue(el, "tasks", function () {
  $(el).text("Step 2");
  $.dequeue(el, "tasks");
});

$.dequeue(el, "tasks");  // start the named queue
Try It Yourself

How It Works

  1. Named queue. "tasks" is separate from the "fx" effects queue.
  2. First step. Uses next after a short delay.
  3. Second step. Continues with $.dequeue(el, "tasks").
  4. Kickoff. The first $.dequeue(el, "tasks") starts the pipeline.

Example 4 — $.dequeue vs .dequeue() vs next()

Three equivalent ways to continue the fx queue.

jQuery
// 1) Static utility
.queue(function () {
  $.dequeue(this);
})

// 2) Instance method (preferred day to day)
.queue(function () {
  $(this).dequeue();
})

// 3) Modern next callback
.queue(function (next) {
  next();
})
Try It Yourself

How It Works

  1. Static. $.dequeue(this) matches older docs and raw DOM nodes.
  2. Instance. $(this).dequeue() is the recommended everyday API.
  3. Next. jQuery passes next into the queue function — clearest modern style.
  4. Pick one. Prefer next() or .dequeue() in new code.

Edge Cases & Pitfalls

Check these before wiring custom steps into animation chains.

stall

Forgot to continue

If a custom .queue() function never calls dequeue / next, later animations freeze. This is the most common bug.

element

Pass a DOM node, not a jQuery object

$.dequeue expects an element. Use this inside the callback, or $el[0].

name

Match the queue name

Custom queues need the same string on queue and dequeue. Default "fx" is for effects only.

stop

.stop() vs dequeue

.stop() interrupts running animations; dequeue advances the queue. Use .clearQueue() to drop waiting steps.

Browser Support

jQuery.dequeue() is available since jQuery 1.3+ in all modern browsers with jQuery loaded. It is a jQuery utility (not a native browser API).

✓ jQuery 1.3+ · Stable

jQuery.dequeue()

Works in Chrome, Firefox, Safari, and Edge whenever jQuery 1.3+ is loaded. Prefer $(el).dequeue() or next() for everyday animation chains.

100% With jQuery loaded
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
$.dequeue() jQuery 1.3+

Bottom line: Use $.dequeue(el) when you hold a raw DOM node. For most UI code, call $(el).dequeue() or next() inside a queue callback.

Performance Notes

ApproachCostBest for
$.dequeue(el)O(1)Advancing one queue step
Long animation stacksUI-boundKeep chains short; clear with .stop(true,true)
Many custom queuesBookkeepingName them clearly; avoid leaking unfinished queues

Dequeue itself is cheap. Cost comes from animations and timers you schedule inside each step — keep queues short and always finish them.

Key Takeaways

  • Role: run the next queued function on an element.
  • Must continue: custom .queue() steps need dequeue / next.
  • Prefer: .dequeue() or next() day to day.
  • Default queue: "fx" unless you pass a custom name.

One line: $.dequeue(this) unlocks the next queue step — forget it and your animation chain stalls.

Frequently Asked Questions

jQuery.dequeue(element [, queueName]) removes the next function from the named queue on that DOM element and runs it. It returns undefined. Added in jQuery 1.3. Prefer $(element).dequeue(queueName) for everyday code.
Same job, different call shape. jQuery.dequeue(elem) takes a raw DOM element (or this inside a queue callback). .dequeue() is called on a jQuery collection. Official docs recommend .dequeue() day to day.
An optional string naming which queue to advance. It defaults to "fx" — jQuery’s standard effects queue used by .animate(). Pass a custom name when you built that queue with .queue("name", fn).
When jQuery runs a function you added with .queue(), the pipeline pauses until you signal completion. Call jQuery.dequeue(this), $(this).dequeue(), or next() so later animations can continue.
No useful return — the static API returns undefined. Instance .dequeue() returns the jQuery object for chaining.
Prefer .dequeue() or next() inside .queue(function(next){ ... next(); }). Use jQuery.dequeue(element) when you already hold a raw DOM node or are reading older $.dequeue(this) examples.

Next: jQuery.each()

Learn how jQuery iterates arrays and plain objects.

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

9 people found this page helpful