Jquery provides us with tools and functions to operate arrays and objects, facilitating and simplifying our operations on them. Today we will go to the jQuery tool function review. In jQuery, a tool function is a method directly attached to a jQuery object, defined for the jQuery object itself, that is, global. we collectively refer to it as a tool function or Utilites function.
Mainly used in: strings, arrays, and objects
API: tool functions
Call format:
$. Function name () or jQuery. function name ()
String operation:
$. Trim (): removes spaces on both sides of the string.
Array and object operations:
$. Each (): traverses the array
$. Each (array, function (index, value) {}): array variable, index: element subscript, starting from 0, value: element value
$ Each (): traverses an object
$ Each (object, function (name, value) {}): object, name: attribute name, value: attribute value
$. Grep (): Data Filtering: returns a filtered array.
$. Map (): modify data
$. InArray (): returns the subscript of an element.
$. InArray (value, array): value: element value, array: searched array, returns the subscript of the element in the array, starting from 0
$. Merge (): merges two arrays.
$. Merge (array1, array2): add the second array to the end of the first array.
$. Unique (): Removes duplicate DOM elements
$. Unique (dom): dom: DOM element
Selector. toArray (): merges multiple DOM elements into an array and returns the innerHTML
Test operation: boolean is returned.
$. IsArray (): determines whether it is an array object and returns a boolean value.
$. IsArray (object): object: the object to be judged
$. IsFunction (): determines whether it is a function. a boolean value is returned.
$. IsFunction (object): object: the object to be judged
$. IsEmptyObject (): determines whether an empty object is returned.
$. IsEmptyObject (object): object: the object to be judged
$. IsPlainObject (): determines whether it is a pure object and returns a boolean value.
Pure Object: objects created by {} or new Object (), such as "var obj = {}" or "var obj = new Object ()"
$. Contains (): determines whether a DOM node contains another DOM node.
$. Contains (dom1, dom2): whether the dom1 node contains the dom2 node
$. Type (): output data type. The data type of the returned object.
$. IsNumeric (): determines whether it is a numerical value.
$. IsWindow (): determines whether it is a Window object.
Window object: Window opened in the browser
URL operation:
$ Param (): converts an object's key-value pair to a URL Key-value pair string
$ Param (object): object to be converted
Browser operation: Disabled
Other operations:
$. Proxy (): adjust the point of this
When an external event calls an object method, this points to a problem (the object that is triggered will be called)
The above is all the content of this article. I hope you will like it.