Brief
The element selector is the element name to query the element
$ ("elementname") Here you can get the jquery element by the element name.
Unlike the ID selector, however, there are many elements with the same name, so many DOM elements are included in the JQuery object that gets to it.
"Index.jsp"
<%@ Pagelanguage= "Java"Import= "java.util.*"pageencoding= "UTF-8"%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"><HTML> <Head> <title>Jquery Test</title> <!--Importing jquery files - <Scripttype= "Text/javascript"src= "${pagecontext.request.contextpath}/jquery-1.5.1.js"></Script> <Scripttype= "Text/javascript">//The content here will execute a $ (function () { //element Selector when the document is loaded, find all DIV elements, it returns a JQuery object, but the jquery object contains multiple DOM var ele=$ ("div"); alert (ele.length); }); </Script> </Head> <Body>This is my JSP page.<BR> <DivID= "id001"><P>Aaaaaa</P></Div> <DivID= "id002">bbbbbb</Div> </Body></HTML>
"Run Results"
02_jquery_02_ element Selector