jQuery .dequeue() Method

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Queue utility

What You’ll Learn

jQuery.dequeue(element [, queueName]) runs the next function waiting on an element’s queue. This tutorial covers the fx default, custom queue names, ending a custom .queue() step with $.dequeue(this), how it relates to .dequeue(), five examples, and try-it labs.

01

Advance

Next in line

02

Element

Raw DOM node

03

queueName

fx or custom

04

Custom steps

Must continue

05

vs .dequeue()

Prefer instance

06

Since 1.3

Low-level

Introduction

jQuery keeps a queue of functions on each element — usually the fx effects queue that powers .animate(), fades, and slides. When one step finishes, the next should run.

Since jQuery 1.3, jQuery.dequeue(element [, queueName]) is the low-level utility that pulls the next function off that queue and executes it. Inside a custom .queue() callback you often see $.dequeue(this) so the chain can continue.

The official API notes that this is low-level: day to day you should prefer .dequeue() on a jQuery collection. Learn jQuery.dequeue so you can read docs and older samples, and so you understand what .dequeue() is doing under the hood. See also .queue() and the Utilities hub.

Understanding the jQuery.dequeue() Method

Call jQuery.dequeue(element) with a DOM element (not a jQuery object). jQuery removes the next function from that element’s queue and runs it. Pass an optional queueName; omit it to use "fx".

Custom queue functions must keep the pipeline moving. After your work (toggle a class, update text, start a timer), call jQuery.dequeue(this) or $(this).dequeue(). Skipping that call leaves later animations waiting forever.

💡
Beginner Tip

Think of jQuery.dequeue(el) as “run the next job for this element.” Prefer $(el).dequeue() in new code; use the static form when you already have a raw node or follow an example that uses $.dequeue(this).

📝 Syntax

Signature (jQuery 1.3+):

jQuery
jQuery.dequeue( element [, queueName ] )

Parameters

  • element (Element) — a DOM element whose queue should advance.
  • queueName (String, optional) — queue to use. Defaults to "fx", the standard effects queue.

Return value

  • undefined — the static utility does not return a jQuery object for chaining.

Typical use inside .queue()

jQuery
$( "div" )
  .animate({ left: "+=200px" }, 2000 )
  .queue(function() {
    $( this ).toggleClass( "red" );
    jQuery.dequeue( this );   // or $( this ).dequeue();
  })
  .animate({ left: "10px" }, 700 );

⚡ Quick Reference

GoalCode
Advance default fx queuejQuery.dequeue( elem );
Advance a named queuejQuery.dequeue( elem, "tasks" );
Inside a queue callback$.dequeue( this );
Preferred instance API$( elem ).dequeue();
Modern next() style.queue(function( next ) { … next(); })
Default queue
fx

Effects / animate pipeline

Argument
Element

Raw DOM node, not $()

Returns
undefined

No chaining from the static call

Prefer
.dequeue()

Instance method for most apps

📋 jQuery.dequeue() vs .dequeue() vs next()

jQuery.dequeue(el)$(el).dequeue()next() in .queue()
LevelStatic utilityInstance methodCallback argument
InputDOM elementjQuery collectionFunction from jQuery
ReturnundefinedjQuery objectn/a (you call it)
Best forLow-level / legacy samplesEveryday codeClear custom steps

Examples Gallery

Examples follow the official jQuery API pattern. Use View Output or Try It Yourself to explore each case.

📚 Getting Started

The classic animate + custom step pattern from the jQuery docs.

Example 1 — Official Demo: Animate, Toggle, Continue

After two animations, a custom queue step toggles a class, then $.dequeue(this) lets the final animate run.

jQuery
$( "button" ).on( "click", function() {
  $( "div" )
    .animate({ left: "+=200px" }, 2000 )
    .animate({ top: "0px" }, 600 )
    .queue(function() {
      $( this ).toggleClass( "red" );
      $.dequeue( this );
    })
    .animate({ left: "10px", top: "30px" }, 700 );
});
Try It Yourself

How It Works

Standard .animate() steps dequeue themselves when finished. The function you add with .queue() does not — so you call $.dequeue(this) (alias for jQuery.dequeue) after your custom work.

Example 2 — jQuery.dequeue(this) Explicitly

Same idea using the full name instead of $.

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

How It Works

this inside the queued function is the DOM element. Passing it to jQuery.dequeue advances the default fx queue so .fadeIn() can run.

📈 Practical Patterns

What goes wrong without dequeue, custom queues, and the preferred instance API.

Example 3 — Stalled Queue (Missing Dequeue)

If you omit jQuery.dequeue, later steps never run.

jQuery
// Broken — fadeIn never starts
$( "#box" )
  .fadeOut( 300 )
  .queue(function() {
    $( this ).addClass( "done" );
    // forgot: jQuery.dequeue( this );
  })
  .fadeIn( 300 );

// Fixed
$( "#box" )
  .fadeOut( 300 )
  .queue(function() {
    $( this ).addClass( "done" );
    jQuery.dequeue( this );
  })
  .fadeIn( 300 );
Try It Yourself

How It Works

Custom queue callbacks are the #1 place beginners “lose” animations. Always finish with jQuery.dequeue(this), $(this).dequeue(), or next().

Example 4 — Custom Queue Name

Advance a named queue that is separate from fx.

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

jQuery.queue( el, "tasks", function( next ) {
  $( el ).text( "Step 1" );
  next();
});
jQuery.queue( el, "tasks", function() {
  $( el ).text( "Step 2 — finishing with jQuery.dequeue" );
  jQuery.dequeue( el, "tasks" );
});

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

How It Works

Named queues stay off the effects pipeline. You must pass the same queueName to jQuery.queue and jQuery.dequeue. The first dequeue starts the run; later steps continue it.

Example 5 — jQuery.dequeue vs .dequeue()

Equivalent ways to continue the same queue.

jQuery
// Static utility (this tutorial)
.queue(function() {
  $( this ).addClass( "a" );
  jQuery.dequeue( this );
})

// Preferred instance method
.queue(function() {
  $( this ).addClass( "b" );
  $( this ).dequeue();
})

// Clearest modern style
.queue(function( next ) {
  $( this ).addClass( "c" );
  next();
})
Try It Yourself

How It Works

Pick one style per codebase. The static method is useful when documenting utilities or holding a raw element; instance .dequeue() and next() read more naturally in plugins and UI code.

🚀 Common Use Cases

  • Finish a custom .queue() step — toggle classes, update text, then continue animations.
  • Official-style samples — follow docs that show $.dequeue(this).
  • Raw DOM helpers — advance a queue when you already have an element reference.
  • Named task queues — run non-fx sequences with jQuery.dequeue(el, name).
  • Debugging stalled animations — check that every custom step dequeues.
  • Learning effects — bridge to .dequeue() and .queue().

🧠 How jQuery.dequeue Fits

1

Functions wait on a queue

Effects and custom steps line up on the element (usually fx).

Queue
2

A step runs

Animate finishes, or your custom .queue() function starts.

Execute
3

Call jQuery.dequeue(el)

For custom steps, you must advance the queue yourself.

Advance
4

Next function runs

The pipeline continues until the queue is empty.

📝 Notes

  • Added in jQuery 1.3; still available in modern jQuery 3.x.
  • Official guidance: prefer .dequeue() over the static utility.
  • First argument must be a DOM element — not a jQuery object or selector string.
  • Default queue name is "fx".
  • Custom .queue() callbacks must dequeue (or call next()) or the chain stalls.
  • Built-in effects usually dequeue automatically when they finish.
  • Returns undefined — unlike .dequeue(), which returns the collection.
  • Related: jQuery.queue(), .clearQueue(), .delay().

Browser Support

jQuery.dequeue() has been part of jQuery since 1.3+. It works in every browser supported by your jQuery build — including modern evergreen browsers with jQuery 3.x. Queue behavior is implemented by jQuery, not by a separate browser API.

jQuery 1.3+

jQuery.dequeue()

Stable low-level queue utility across supported jQuery versions. Prefer .dequeue() for element collections.

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

Bottom line: Use to continue queues; prefer instance .dequeue() in application code.

Conclusion

jQuery.dequeue() executes the next function on an element’s queue. It is the low-level twin of .dequeue() — essential to recognize in docs and custom queue callbacks, while most new code should call the instance method or next().

Next up: jQuery.each() for iterating arrays and objects.

💡 Best Practices

✅ Do

  • Call dequeue (or next()) at the end of every custom queue step
  • Pass a real DOM element to jQuery.dequeue
  • Match queueName when using custom queues
  • Prefer .dequeue() or next() in new UI code
  • Use try-it labs to feel stalled vs fixed queues

❌ Don’t

  • Forget dequeue inside .queue(function(){ … })
  • Pass a jQuery object where an Element is required
  • Mix up fx with a custom queue name
  • Expect a chainable return from the static method
  • Clear a queue when you meant to advance it (.clearQueue() is different)

Key Takeaways

Knowledge Unlocked

Five things to remember about jQuery.dequeue

The low-level queue-advance utility.

5
Core concepts
DOM 02

Needs

Element

Arg
fx 03

Default

fx

Queue
! 04

Custom

Must call

Continue
05

Prefer

.dequeue()

Instance

❓ Frequently Asked Questions

jQuery.dequeue(element [, queueName]) removes the next function from the named queue on that DOM element and runs it immediately. It returns undefined. Added in jQuery 1.3. It is a low-level helper — prefer $(element).dequeue(queueName) in most 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: $(elem).dequeue(). Official docs recommend .dequeue() for everyday use; jQuery.dequeue() is the underlying utility.
An optional string naming which queue to advance. It defaults to "fx" — jQuery’s standard effects queue used by .animate() and similar methods. Pass a custom name (for example "tasks") when you built the queue with jQuery.queue(elem, "tasks", fn) or .queue("tasks", fn).
When jQuery runs a function you added with .queue(), the pipeline pauses until you signal completion. Calling jQuery.dequeue(this) or $(this).dequeue() (or next() in the modern signature) starts the next step. Without that signal, later animations stay stuck.
No useful return — the API returns undefined. Instance .dequeue() returns the jQuery object for chaining; the static utility does not.
Prefer .dequeue() (or next() inside .queue(function(next){ ... next(); })). Use jQuery.dequeue(element) when you already hold a raw DOM node, are reading older examples that use $.dequeue(this), or are writing low-level queue utilities.
Did you know?

The official jQuery demo for jQuery.dequeue is almost identical to the .dequeue() demo — because the instance method is a thin wrapper around the same queue machinery. Learning one teaches the other; the static form just makes the element argument explicit.

Next: jQuery.each() Method

Iterate arrays and plain objects with a shared callback helper.

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

8 people found this page helpful