This refers to the native JS Dom object
. CSS (""): Write only one value is value, write two values is assignment
Window.onload = = = $ (document). Ready ();
$ (""): Gets the element tag name,. Class name, #id
JQuery features
- Chained programming
- Jq.shou (in). HTML (content)
- Equivalent
- Jq.shou (3000)
- jq.gtml (content)
- Implicit iteration
- Implicit practical for loop, iteration
How to use jQuery
- Primer Package
- Be sure to use it before
- <script src = ' ><>
- Entry function
- $ (document). Ready (function ({}))
- Binding time between
- Event source. event (function () {event-driven function})
jQuery Entry function
- The function is executed when the document is loaded and the picture is not loaded
- $ (document). Ready (function ({}))
- $ (function () {})
- Both the document and the picture are loaded to execute the function
- $ (window). Reday (function () {})
- JS entry can only be once, multiple times will overwrite
- Jqery can have multiple entry functions
- $ = = = JQuery
The difference between jQuery and DOM objects
- The jquery object is an array that contains the native Jsdom object
- Native JS object is a native object
- jQuery Object Name = $(JS object name)
- JS object converted to jQuery object
- jquery object name [index value]
- jquery object name. Get (WWM index value)
- Different objects have different methods
- The JQuery object method contains native JS object methods.
- jquery object. The return value of length is the number of elements
jQuery Selector
- Basic: #id,. class, tag name,
- * Wildcard Selector
- Hierarchy Selector
- Descendant selector >
- Descendant selector Spaces separated
- Basic Filter Selector
- : eq (index) iterates through an array of elements
- : Odd gets the elements of an even-digit index
- : Even an element that obtains an odd-digit index value
- Filter selectors
- Find (Selector): Finds all child elements of the parent element
- Parent element . Find(' child element to find ')
- Find all descendants child elements
- Children: Pro-son
- The parent element . Children(' child element to find ')
- Find only child elements
- : EQ (Index)
- Next (); Next sibling node
- Parent (): Gets the parent element of the element
- Siblings: All sibling nodes (not including itself)
<! DOCTYPE html>;} UL {List-style-Type:none;} . parentwrap {width:200px; Text-Align:center; }. Menugroup {border:1px solid #999; Background-color: #e0ecff; }. grouptitle {display:block; height:20px; Line-height:20px; Font-size:16px; Border-bottom:1px solid #ccc; Cursor:pointer; }. Menugroup>Div {height:200px; Background-color: #fff; Display:none; } </style> <script src= "Jquery-1.11.1.min.js" ></script> <script> $(function () { //need: Mouse click on span, let him below the Div show out. Let the other div hide. $ (". Parentwrap span"). Click (function () {//$ (this). Next (). Show ();////Let the other hide////Click on the span of the Father Li, all of the brother elements of Li, the child element div all hidden. //$ (this). Parent ("Li"). Siblings ("Li"). Children ("div"). Hide (); //Connected Programming$( This). Next (). Show (). Parent ("Li"). Siblings ("Li"). Find ("div"). Hide (); }); }) </script>Accordion Case
JQuery-01. jquery features, how to use jquery, the jquery entry function, the difference between jquery and Dom objects, the jquery selector,