One: The jquery object and JS Dom object convert each other
HTML code
1 <ul>2 <binclass= "SXF"name= "DD">First</Li>3 <Liclass= "SXF"name= "DD">Second</Li>4 <Liclass= "SXF"name= "DD">Third</Li>5 <Liclass= "SXF"name= "DD">Fourth</Li>6 </ul>7 <inputtype= "button"value= "Test"onclick= "Test ();">
View Code
JS Code
1 functionTest () {2 //jquery object (class array)3 var$li =$ (". Sxf");4Alert ($li. length);//45 //Jquery-->dom Object (subscript starting from 0)6 varLi= $li [0];7alert (li.innerhtml);//First8 //Jquery-->dom Object (subscript starting from 0)9 varLid= $li. Get (1);Tenalert (lid.innerhtml);//Second One A //DOM Objects (arrays) - varDli=document.getelementsbyname ("DD"); -alert (dli.length);//4 the //DOM--->jquery object (subscript starting from 0) - var$ld =$ (dli[2]); -Alert ($ld. HTML ());//Third - //DOM--->jquery object (the first element in the array is converted to a jquery object by default) + var$ads =$ (DLI); -Alert ($ads. HTML ());//First + A}
View Code
two : The difference between the Readay event of jquery and the Load event of window
$ (document). Readay (function () {//All execution code});
$ (function () {//All execution code});
Window.onload=function () {//All execution code};
----> Page load Rendering order
(1) parsing the HTML structure
(2) loading external scripts and style sheet files
(3) parsing and executing script code
(4) Constructing the HTML DOM model
(5) loading external files such as pictures
(6) Page load complete
the Reday event of the--->juqery is activated when the HTML DOM model is constructed (4)
--->load event will be activated when external files such as (5) loading pictures are completed.
--->reday event can be written in more than one page. are able to execute
--->load event can only be written in one page. If you write more than one, perform the last one, the front of the invalidation.
jquery Re-learning (1)