Basic knowledge of jquery
class= "BB" >22</div><divclass= "BB" >33</div><divclass= "BB" >44</div><input type= "text" Name= "CC" bs= "dd"/></body><script type= "Text/javascript" >$ (document). Ready (function(e) {//Find the element based on the ID, the specific jquery object is found, if you want to fetch the DOM object, then the object of index 0 is taken varJD = $ ("#aa");//by ID varJC = $ (". BB");//according to class varJdiv = $ ("div");//according to the label name varIP = $ ("input[name=cc]");//Filter by attributes in square brackets for(vari=o;i<jc.length;i++) {JC. EP (i);//EP is the first of several jquery objects inside an array } //action content//1. Non-TABLE elementJd.text ();//value method, take contentJd.text ("AA");//method of assigning valuesJd.html ();//take the value method, take the codeJd.html ("VV");//assignment method//2. Table cell ElementJd.val ();//Take valueJd.val ("")//Assignment//Operation PropertiesJd.attr ("BS", "AA");//Setting PropertiesJd.attr ("BS");//Get PropertiesJd.removeattr ("BS");//Remove attributes//action styleJd.css ("Background-color", "green") //add an event to an element$ ("#aa"). Click (function() {alert ("AA"); }); //adding events to multiple elements$ (". BB"). Click (function() {Alert ($ (this).text ()); }); //set the same style for multiple elements$ (". BB"). CSS ("Color", "brown"));});</script>
The all-in-choice application of jquery
Select All<inputclass= "T" type= "checkbox" value= "AA"/>AA<inputclass= "T" type= "checkbox" value= "BB"/>BB<inputclass= "T" type= "checkbox" value= "CC"/>cc<inputclass= "T" type= "checkbox" value= "dd"/>DD<inputclass= "T" type= "checkbox" value= "ee"/>ee<input type= "button" value= "Test" id= "btn"/><input type= "text" id= "Tex"/><input type= "button" value= " Set check "id=" sel "/></body><script type=" Text/javascript ">$ (document). Ready (function(e) {//Select All$ ("#all"). Click (function(){ varCK = $ (". T"); varXZ = $ (this) [0].checked; CK. Prop ("Checked",XZ); }); //the selected value$ ("BTN"). Click (function(){ varCK = $ (". T"); for(vari=0;i<ck.length;i++) { if(Ck.eq (i). Prop ("checked"))//Ck.eq (i) [0].checked{alert (CK. EQ (i).Val ()); } } }); //sets an item selected $("#sel"). Click (function(){ varv = $ ("#tex").Val (); varCK = $ (". T"); CK. Prop ("Checked",false); for(vari=0;i<ck.length;i++) { if(Ck.eq (i). val () = =v) {CK. EQ (i). Prop ("Checked",true) } } })});
May 13 jquery Basics