<HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <title> jquery $ (". class1 ") method </title> <br/> <MCE: Script Type =" text/JavaScript "src =" style/jquery. min. JS "mce_src =" style/jquery. min. JS "> </MCE: SCRIPT> <br/> <MCE: Script Type =" text/JavaScript "> <! -- <Br/> // use JavaScript to directly implement jquery $ (". class1 ") method <br/> // the idea is to first find similar labels, such as Div and table, and then traverse the array to determine <br/> // Div label traversal is implemented here, perform table and body operations in sequence. <br/> function fcheck () {<br/> var classarray = []; // array used to save the same elements of the class <br/> var divarr = document. getelementsbytagname ("Div"); // obtain similar tags Based on the tag name <br/> for (VAR I = 0; I <divarr. length; I ++) {// traverse similar labels <br/> var divattr = divarr [I]. classname; // judge the class name <br/> If (divattr! = "") {// If there is no class attribute, It is null <br/> If (divattr = "class1") {// if similar match, put it in the array <br/> classarray. push (divarr [I]); <br/>}< br/> for (VAR J = 0; j <classarray. length; j ++) {<br/> alert (classarray [J]. innerhtml); <br/>}</P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <Div id = "div1" onclick = "fcheck (); "> click <br/> <Div class =" class1 "> 1 </div> <br/> <Div class =" class1 "> 2 </div> <br/> <Div class = "class1"> 3 </div> <br/> </body> <br/> </ptml>