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(); })
Advance a paused queue after your custom step finishes.
Build a chain with .animate() / .fadeOut() and a custom .queue() step.
Inside that step, do your work (toggleClass, change text, etc.).
Call $.dequeue(this) (or $(this).dequeue() / next()) to continue.
For a named queue, pass the same name: $.dequeue(el, "tasks").
Piece
Required?
Role
element
Yes
Raw DOM element holding the queue
queueName
No
Defaults 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
Reference
Cheat Sheet
Keep these facts handy while continuing jQuery queues.
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.