JQuery utility function summary

  • 2020-06-15 07:38:39
  • OfStack

In jQuery, utility functions refer to methods that are directly attached to the jQuery object and defined for the jQuery object itself, i.e., global, collectively referred to as utility functions, or Utilites functions

Mainly used on: string, array, object

API: Utility functions

Call format:
$. Function name () or jQuery. function name ()

String operation:

$.trim () : Removes the Spaces on the left and right sides of the string

Array and object operations:

$.each() : Iterate over the groups

$.each (array,function(index,value){}) : array: array variable, index: element subscript, starting at 0, value: element value

$each() : Traverses the object

$each(object,function(name,value){}) : object: object, name: attribute name, value: attribute value

$.grep () : Data filter: Returns 1 filtered array

$.map () : Modify data

$.inArray () : Finds the subscript of the element

$.inArray (value,array) : value: element value, array: Find the array, return the subscript of the element in the array, starting at 0

$.merge () : Merge two arrays

$.merge (array1,array2) : Add the second array to the first array

$.unique () : Removes duplicate DOM elements

$.unique(dom) : dom:DOM element

selector. toArray() : Merges multiple DOM elements into arrays, returns innerHTML of array elements

Test operation:, return boolean

$.isArray () : Determines whether it is an array object, returns boolean

$.isArray (object) : object: the object being judged

$.isFunction () : Determines whether it is a function, returns boolean

$.isFunction(object) : object: judged object

$.isEmptyObject () : Returns boolean for null

$.isEmptyObject(object) : object: object to be judged

$.isPlainObject () : Determines whether it is a pure object, returns boolean

Pure objects: objects created by {} or new Object(), such as "var obj = {}" or "var obj = new Object()"

$.contains () : Determines whether the DOM node contains another DOM node

$.contains(dom1,dom2) : Whether dom1 node contains dom2 node

$.type () : Output data type, return object data type

$.isNumeric () : Determines whether it is a numeric type

$.isWindow () : Determines whether it is an Window object

Window object: Represents an open window in the browser

URL operation:

$param() : Converts the object's key-value pair to an URL key-value pair string

$param(object) : object: Object to be transformed

Browser action: Deprecated

Other operations:

$.proxy() : Adjust the direction of this

this points to a problem when an external event triggers the invocation of an object method (the object that will be invoked)

This is the end of this article, I hope you enjoy it.


Related articles: