These utility methods are often very useful when writing scripts using jQuery.
Properties of the jQuery object
Properties of the jQuery object
Property |
Description |
$.support |
Returns an object containing properties indicating whether the browser supports various feactures and standards. |
Arrays and objects
Arrays and objects
Function |
Description |
$.each(collection, callback) |
Iterates over collection, executing callback for each item. |
$.extend(target, addition, …) |
Modifies the object target by adding properties from the other supplied objects. |
$.grep(array, callback, [invert]) |
Filters array by using calback as a test. |
$.makeArray(object) |
Converts object into an array. |
$.map(array, callback) |
Constructs a new array consisting of the result of callback being called on each item. |
$.inArray(value, array) |
Determines whether value is in array. |
$.merge(array1, array2) |
Combines the contents of array1 and array2. |
$.unique(array) |
Removes any duplicate DOM elements from array. |
Object introspection
Object introspection
Function |
Description |
$.isArray(object) |
Determines whether object is a true JavaScript array. |
$.isEmptyObject(object) |
Determines whether object is empty. |
$.isFunction(obejct) |
Determines whether object is a function. |
$.isPlainObject(object) |
Determines whether object was created as an object literal or with new object. |
$.isNumeric(object) |
Determines whether object is a numeric scalar value. |
$.isWindow(object) |
Determines whether object is an XML node. |
$.isXMLDoc(object) |
Determines whether object is an XML node. |
$.type(object) |
Gets the JavaScript class of object. |
Other
Other
Function |
Description |
$.trim(string) |
Removes whitespace from the ends of string. |
$.noConflict([removeAll]) |
Reverts $ to its pre-jQuery definition. |
$.noop() |
A function that does nothing. |
$.now() |
The current time in milliseconds since the epoch. |
$.holdReady(hold) |
Stops the ready event from being triggered, or releases this hold. |
关于作者:楠溪江人,出生于1991年,目前坐标上海。读书时代跳过级、保过送,工作后转过行。2013年本科毕业于北药。看书、码字、敲代码、打羽毛球是我花时间的爱好。曾在某上市药企任国际药品注册岗,现在某高新企业任前端管理岗。