jquery Some notes

Source: Internet
Author: User

"1" | | is logical
|| is logical OR, if the previous expression is true, you can directly determine that the result is true, so that the latter expression is no longer executed, and the latter expression is executed only if the current expression is false.
In JavaScript, null,0,undefined all as false.

"2" $.isfunction () method
The $.isfunction (obj) function is used to determine whether a specified parameter is a function. return bool Value

The "3" unescape (string) decodes the string. Returns the decoded string value

The "4" hasclass () method checks whether the selected element contains the specified class name. return bool Value
For example: $ ("P"). Hasclass ("Intro") check whether the <p> element contains the "Intro" Class

The "5" Event.target property returns which DOM element triggered the event.

The "6" Parent is a collection of elements that gets a unique parent element that contains all the matching elements.
Parents is a collection of elements (without the root element) that has an ancestor element that contains all the matching elements. You can filter by an optional expression.
<div id= ' Div1 ' >
<div id= ' Div2 ' ><p></p></div>
<div id= ' div3 ' class= ' a ' ><p></p></div>
<div id= ' div4 ' ><p></p></div>
</div>

$ (' P '). The parent () takes the DIV2,DIV3,DIV4
$ (' P '). The parent ('. A ') takes the Div3
$ (' P '). The parent () parent () takes the Div1, which is quite peculiar, but the characteristics of the jquery object itself determine that this is possible.
$ (' P '). Parents () Take the DIV1,DIV2,DIV3,DIV4
$ (' P '). Parents ('. A ') takes the Div3
"6" event.preventdefault (); Prevent links from opening URLs:
"7" As $ ("Div>ul a"), it means a tag in the UL tag of the DIV tag
However, $ (' Div>ul ') and $ (' div ul ') are different,
$ (' Div>ul ') is a direct descendant of <div> to find <ul>;
and $ (' div ul ') is found in all descendants of <div> <ul>.

The "8" $.extend () function is used to merge the contents of one or more objects into the target object.
such as: $.extend (OBJ1,OBJ2); Merging Obj2 into Obj1;
"9" in jquery, traversing an object typically uses $ (). Each, iterate over the array using $.each () two methods
"10" eval (string) execution string
The "11" push () method adds one or more elements to the end of the array and returns the new length.
The "12" prop method gets a fixed property with the HTML itself
The attr method is to get the HTML element we define ourselves as a DOM property such as ID, name
IndexOf usage in "13" JS: Returns the position of the first occurrence of a specified string value in a string

jquery Some notes

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.