jQuery miscellaneous methods

jQuery miscellaneous methods

method describe
data() Append data to selected elements, or get data from selected elements
each() Execute the function for each matched element
get() Get the DOM element specified by the selector
index() Searches for a given element from matching elements
$.noConflict() Release jQuery control of variable $
$.param() Creates a serialized representation of an array or object (can be used in URL query strings when making AJAX requests)
removeData() Remove previously stored data
size() Deprecated in version 1.8. Returns the number of DOM elements matched by the jQuery selector
toArray() Retrieves all DOM elements contained in the jQuery collection as an array
pushStack() Adds a collection of DOM elements to the jQuery stack
$.when() Provides a way to execute callback functions for one or more objects


 


jQuery Utilities

method describe
$.boxModel Deprecated in version 1.8. Detects whether the browser renders the current page using the W3C's CSS box model
$.browser Deprecated in version 1.9. Returns information about the browser the user is currently using
$.contains() Determines whether another DOM element is a descendant of the specified DOM element
$.each() Iterate over specified objects and arrays
$.extend() Merge the contents of one or more objects into the target object
$.fn.extend() Extends one or more instance properties and methods for jQuery
$.globalEval() Execute a piece of JavaScript code globally
$.grep() Filter and return array elements that satisfy the specified function
$.inArray() Finds the specified value in the array and returns its index (or -1 if not found)
$.isArray() Determine whether the specified parameter is an array
$.isEmptyObject() Checks if the object is empty (contains no properties)
$.isFunction() Determine whether the specified parameter is a function
$.isNumeric() Determines whether the specified parameter is a numeric value
$.isPlainObject() Determine whether the specified parameter is a pure object
$.isWindow() Determine whether the specified parameter is a window
$.isXMLDoc() Determine whether a DOM node is located in an XML document, or itself is an XML document
$.makeArray() converts an array-like object to a true array object
$.map() The specified function processes each element in the array (or each attribute of the object), and encapsulates the processing result as a new array to return
$.merge() Merge the contents of two arrays into the first array
$.noop() an empty function
$.now() return current time
$.parseHTML() Parses an HTML string into an array of corresponding DOM nodes
$.parseJSON() Convert a JSON string conforming to the standard format to the corresponding JavaScript object
$.parseXML() Parses a string into a corresponding XML document
$.trim() Remove whitespace characters from both ends of a string
$.type() Determining the type of a JavaScript built-in object
$.unique() Deprecated in jQuery 3.0. Sort an array of DOM elements and remove duplicate elements
$.uniqueSort() Sort an array of DOM elements and remove duplicate elements
$.data() Access data on the specified element and return the set value
$.hasData() Determine if an element has associated jQuery data
$.sub() Creates 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 custom animations
$.htmlPrefilter() Modify and filter HTML strings via jQuery action methods
$.readyException() Handle errors thrown synchronously by functions wrapped in jQuery()


 


jQuery callback object

The new jQuery.Callbacks() function in jQuery 1.7 returns a multi-purpose object, which provides a powerful way to manage the callback list. It can add, delete, trigger, disable callback functions.

method describe
$.Callbacks() A multi-purpose callback list object, used to manage the list of callback functions
callbacks.add() Add a callback or a collection of callbacks to the callback list
callbacks.disable() Disable callback functions in the callback list
callbacks.disabled() Determine if the callback list has been disabled
callbacks.empty() 从列表中清空所有的回调
callbacks.fire() 传入指定的参数调用所有的回调
callbacks.fired() 确定回调是否至少已经调用一次
callbacks.firewith() 给定的上下文和参数访问列表中的所有回调
callbacks.has() 判断回调列表中是否添加过某回调函数
callbacks.lock() 锁定当前状态的回调列表
callbacks.locked() 判断回调列表是否被锁定
callbacks.remove() 从回调列表中的删除一个回调或回调集合


 


jQuery 延迟对象

在jQuery 1.5中介绍了 Deferred 延迟对象,它是通过调用 jQuery.Deferred() 方法来创建的可链接的实用对象。它可注册多个回调函数到回调列表,调用回调列表并且传递异步或同步功能的成功或失败的状态。
延迟对象是可链接的,类似于一个 jQuery 对象可链接的方式,区别于它有自己的方法。在创建一个 Deferred 对象之后,您可以使用以下任何方法,直接链接到通过调用一个或多个的方法创建或保存的对象。

方法 描述
$.Deferred() 返回一个链式实用对象方法来注册多个回调
deferred.always() 当Deferred(延迟)对象被受理或被拒绝时,调用添加的处理程序
deferred.done() 当Deferred(延迟)对象被受理时,调用添加的处理程序
deferred.fail() 当Deferred(延迟)对象被拒绝时,调用添加的处理程序
deferred.isRejected() 从jQuery1.7开始已经过时,确定 Deferred 对象是否已被拒绝
deferred.isResolved() 从jQuery1.7开始已经过时,确定 Deferred 对象是否已被解决
deferred.notify() 给定一个参数,调用正在延迟对象上进行的回调函数( progressCallbacks )
deferred.notifyWith() Given the context and arguments, call the callback function ( progressCallbacks ) that is in progress on the deferred object
deferred.pipe() Utility methods for filtering and/or chaining deferred objects
deferred.progress() Add handler called when a Deferred object generates a progress notification
deferred.promise() A Promise object that returns a Deferred
deferred.reject() Rejects the Deferred (deferred) object and calls any failCallbacks callback function according to the given parameters
deferred.rejectWith() Rejects the Deferred (deferred) object, and calls any failCallbacks callback functions according to the given context and args parameters
deferred.resolve() Resolves the Deferred object and calls any doneCallbacks callback functions with the given parameters
deferred.resolveWith() Resolves the Deferred object and calls any doneCallbacks callback functions with the given context and args parameters
deferred.state() Determine the current state of a Deferred object
deferred.then() Add handler called when Deferred object resolves, rejects or is still in progress
.promise() Returns a Promise object to observe whether all actions of a certain type bound to the collection have been added to the queue

Guess you like

Origin blog.csdn.net/unbelievevc/article/details/131049627