jquery Tool class functions

Source: Internet
Author: User

1. Get the name and version information of the browser

In jquery, the $.browser object can get the name and version information of the browser, such as $.browser.chrome to true, which means the current chrome browser, $. Broeser.mozilla is true, which means Firefox is currently available, and the browser version information can be obtained by $.browser.version Mode.

2, check whether the browser belongs to the box model

The browser box model is divided into two categories, one for the standard box model, the other for the IE box model, the difference between the width and height of the two attribute values include padding and border values, The box model is not included, IE box model is included, In jquery, you can detect whether the browser belongs to the standard box model by $.support.boxmodel the value returned by the Object.

3, detects if the object is empty

In jquery, you can call a tool function called $.isemptyobject, which detects if the contents of an object are empty, or if it is empty, returns true if it is null, otherwise it returns a value of False.

$.isemptyobject (obj);

Where the parameter PBJ represents the name of the object that needs to be detected.

4, detects whether the object is the original object

Invokes a tool function named $.isplainobject that detects whether the object is the original object that is worn through the {} or new object () keyword, and if it is, returns true, otherwise, returns false,

$.isplainobject (obj);

Where the parameter obj represents the object name that needs to be detected

5, detection of the two-phase containment relationship

Call a tool function named $.contains, which detects if another DOM node is contained in a DOM node, and returns True if it is contained, or false if it is Included.

$.contains (container,contained);

The parameter container represents a DOM object node element that is used to contain containers for other nodes.

6, string manipulation function

Call the number of tools named $.trim, can delete the left and right side of the string space, but the function can not delete spaces in the string

$.trim (str);

7,url operation function

Invokes a tool function named $.param that enables an object or array to be serialized in the Key/value format, which is often used to send URL requests to the server

$.param (obj)

The parameter obj needs to serialize the object, which can also be a box of arrays, the entire function returns a serialized encoded string

8. Using the $.extend extension tool function

Call the tool function named $.extend, can expand the original tool function, custom Class-level jquery Plug-in

$.extend ({options})

9. Extending object objects with $.extend ()

In addition to using the $.extend extension tool function, You can extend the original object object by merging two objects when the object is extended, and when the merge property name exists, The latter overrides the former

$.extend (obj1,obj2....objn);

Parameters obj1 to Objn represent the various original objects that need to be merged

jquery Tool class 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.