Dom-independent jquery utility functions

Source: Internet
Author: User

Utility function: Defines a function that does not manipulate the wrapper set under the Jquery/$ namespace, and can be seen as a top-level function defined on an instance rather than a window instance. In general, these utility functions either manipulate objects other than DOM elements, or perform some object-independent operations.

jquery flags for public use:

$.fx.off: Enable or disable effects, do not remove the effects that have been used on the page, just disable the animation effects.

$.support: Details of supported features

$.browser: Public Browser details,jQuery starting with version 1.9, removed $.browser and $.browser.version, replaced by $.support.

$.noconflict (Jquerttoo): Returns the control of $ to another library, invokes the functionality of jquery using the jquery identifier, and discards the $ and jquery identifiers if the parameter is set to True.

Manipulating JavaScript objects and collections

$.trim (value): Removes whitespace characters from the beginning and end of the passed-in string (matches \s characters, also including page breaks, line feeds, carriage returns, tabs, vertical tabs, and \u00a0), returning the modified result

$.each (Container, callback): Iterates through each entry of the incoming container and invokes the callback function

$.grep (Array, callback, invert): Filter array, callback function returns True if the current value is collected to a new array unless invert is set to True (returns false is collected)

$.map (Array, callback): invokes the callback function for each item of the array, collecting the return value of the function call into the new array

$.inarray (value, array): Returns the subscript of the first occurrence of an incoming value

$.makearray (object): Converts an array-like object to an arrays (NodeList arguements)

$.unique (Array): Returns an array of elements that are not duplicates in the original array

$.merge (Array1, array2): Merges the value of the second array into the first array

$.extend (deep, Target, source1, ...)

$.param (params, Traditional): Serializes the incoming information into the query string when the request is submitted, and each name and value of the string is URI-encoded.

Test object

$.isarray $.isemptyobject $.isfunction $.isplainobject $.isxmldoc (node)

Test containment Relationship

$.contains (Container, Containee): detects whether the previous element is contained within the next element in the Doom hierarchy

Attaching data to an element

$.data (element, name, value): Stores or examines data in the passed-in element with the specified name

$.removedata (element, name): delete data on an element

Pre-bound function context

Jquery.proxy (function, context): Accepts a function and then returns a new function, and the new function always maintains a specific context. The most common use is to bind the object's method to the processor, and the object that owns the method as the function context of the processor.

Function: Functions that will change the context context.

Context: A function's contextual context (' this ') is set to this object.

Jquery.proxy (context, name)

Context: A function's contextual context is set to this object.

Name: The function name that will change the context context (this function must be the property of the previous parameter ' context ' object)

Parsing JSON

$.parsejson (JSON): Parses an incoming JSON string and returns its computed value

Evaluation of an expression

$.globaleval (Code): evaluates incoming JavaScript code in a global context

Dynamic load Scripts

GetScript (URL, callback): Initiates a GET request to the specified server gets the script specified by the URL, and (optionally) a callback function after successful invocation

Dom-independent jquery utility functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.