Easy Tutorial
❮ Prop Context Event Mouseleave ❯

jQuery .promise() Method

jQuery Miscellaneous Methods

Example

Calling .promise() on a collection without active animations

$(function () { 
    var div = $( "<div />" );
    div.promise().done(function( arg1 ) {
        // Alerts "true"
        alert( this === div && arg1 === div );
    });
})

Definition and Usage

The .promise() function returns a Promise object that observes when all actions of a certain type bound to the collection have been queued.

Note: 1. The .promise() method returns a dynamically generated Promise, which is resolved when all specific actions bound to the collection have been queued or not queued.


Syntax

Parameter Description
type String type, the type of queue to observe.
target PlainObject type, the object to which the promise method will be attached.

More Examples

Call resolve on the returned Promise when the animation ends

Use $.when() statement to resolve the returned Promise


jQuery Miscellaneous Methods

❮ Prop Context Event Mouseleave ❯