jQuery Miscellaneous Methods
jQuery Miscellaneous Methods
| Method | Description |
|---|---|
| data() | Attach data to, or get data from, the selected elements |
| each() | Execute a function for each matched element |
| get() | Get the DOM elements specified by a selector |
| index() | Search for a given element among matched elements |
| $.noConflict() | Release jQuery's control of the $ variable |
| $.param() | Create a serialized representation of an array or object (usable in a URL query string when generating AJAX requests) |
| removeData() | Remove previously stored data |
| size() | Deprecated in version 1.8. Return the number of DOM elements matched by a jQuery selector |
| toArray() | Retrieve all DOM elements contained in a jQuery collection as an array |
| pushStack() | Add a collection of DOM elements to the jQuery stack |
| $.when() | Provide a way to execute callback functions for one or more objects |
jQuery Utilities
| Method | Description |
|---|---|
| $.boxModel | Deprecated in version 1.8. Check whether the browser renders the current page using the W3C CSS box model |
| $.browser | Deprecated in version 1.9. Return information about the browser currently used by the user |
| $.contains() | Determine whether another DOM element is a descendant of the specified DOM element |
| $.each() | Iterate over the specified object or array |
| $.extend() | Merge the contents of one or more objects into the target object |
| $.fn.extend() | Extend jQuery with one or more instance properties and methods |
| $.globalEval() | Execute a piece of JavaScript code globally |
| $.grep() | Filter and return the array elements that satisfy the specified function |
| $.inArray() | Search an array for a specified value and return its index (or -1 if not found) |
| $.isArray() | Determine whether the specified argument is an array |
| $.isEmptyObject() | Check whether an object is empty (contains no properties) |
| $.isFunction() | Determine whether the specified argument is a function |
| $.isNumeric() | Determine whether the specified argument is a numeric value |
| $.isPlainObject() | Determine whether the specified argument is a plain object |
| $.isWindow() | Determine whether the specified argument is a window |
| $.isXMLDoc() | Determine whether a DOM node is located in an XML document, or is itself an XML document |
| $.makeArray() | Convert an array-like object into a true array object |
| $.map() | Process each element in an array (or each property of an object) with the specified function, and return the results wrapped in a new array |
| $.merge() | Merge the contents of two arrays into the first array |
| $.noop() | An empty function |
| $.now() | Return the current time |
| $.parseHTML() | Parse an HTML string into the corresponding array of DOM nodes |
| $.parseJSON() | Convert a well-formed JSON string into the corresponding JavaScript object |
| $.parseXML() | Parse a string into the corresponding XML document |
| $.trim() | Remove whitespace from both ends of a string |
| $.type() | Determine the type of a JavaScript built-in object |
| $.unique() | Deprecated in jQuery 3.0. Sort an array of DOM elements and remove duplicates |
| $.uniqueSort() | Sort an array of DOM elements and remove duplicates |
| $.data() | Store data on the specified element and return the set value |
| $.hasData() | Determine whether an element has associated jQuery data |
| $.sub() | Create a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object |
| $.speed | Create an object containing a set of properties to define a custom animation |
| $.htmlPrefilter() | Modify and filter an HTML string through jQuery manipulation methods |
| $.readyException() | Handle errors thrown synchronously by a function wrapped in jQuery() |
jQuery Callbacks Object
The jQuery.Callbacks() function, new in jQuery 1.7, returns a multi-purpose object that provides a powerful way to manage a callback list. It can add, remove, trigger, and disable callbacks.
| Method | Description |
|---|---|
| $.Callbacks() | A multi-purpose callback list object used to manage a list of callback functions |
| callbacks.add() | Add a callback or a collection of callbacks to a callback list |
| callbacks.disable() | Disable the callbacks in a callback list |
| callbacks.disabled() | Determine whether a callback list has been disabled |
| callbacks.empty() | Remove all callbacks from the list |
| callbacks.fire() | Invoke all callbacks with the given arguments |
| callbacks.fired() | Determine whether the callbacks have been called at least once |
| callbacks.firewith() | Access all callbacks in the list with a given context and arguments |
| callbacks.has() | Determine whether a callback function has been added to a callback list |
| callbacks.lock() | Lock a callback list in its current state |
| callbacks.locked() | Determine whether a callback list has been locked |
| callbacks.remove() | Remove a callback or a collection of callbacks from a callback list |
jQuery Deferred Object
Introduced in jQuery 1.5, the Deferred object is a chainable utility object created by calling the jQuery.Deferred() method. It can register multiple callbacks into a callback list, invoke the callback list, and relay the success or failure state of any synchronous or asynchronous function.
Deferred objects are chainable, similar to the way a jQuery object is chainable, except that they have their own methods. After creating a Deferred object, you can use any of the following methods to chain directly to the object created or saved by calling one or more methods.
| Method | Description |
|---|---|
| $.Deferred() | Return a chainable utility object with methods to register multiple callbacks |
| deferred.always() | Call the added handlers when the Deferred object is resolved or rejected |
| deferred.done() | Call the added handlers when the Deferred object is resolved |
| deferred.fail() | Call the added handlers when the Deferred object is rejected |
| deferred.isRejected() | Deprecated since jQuery 1.7. Determine whether a Deferred object has been rejected |
| deferred.isResolved() | Deprecated since jQuery 1.7. Determine whether a Deferred object has been resolved |
| deferred.notify() | With a given argument, call the progress callbacks (progressCallbacks) on the Deferred object |
| deferred.notifyWith() | With a given context and arguments, call the progress callbacks (progressCallbacks) on the Deferred object |
| deferred.pipe() | A utility method to filter and/or chain Deferred objects |
| deferred.progress() | Call the added handlers when the Deferred object generates a progress notification |
| deferred.promise() | Return the Promise object of a Deferred |
| deferred.reject() | Reject a Deferred object and call any failCallbacks with the given arguments |
| deferred.rejectWith() | Reject a Deferred object and call any failCallbacks with the given context and args |
| deferred.resolve() | Resolve a Deferred object and call any doneCallbacks with the given arguments |
| deferred.resolveWith() | Resolve a Deferred object and call any doneCallbacks with the given context and args |
| deferred.state() | Determine the current state of a Deferred object |
| deferred.then() | Call the added handlers when the Deferred object is resolved, rejected, or still in progress |
| .promise() | Return a Promise object to observe when all actions of a certain type bound to a collection have been queued |