Element selector (“element”)

Selects all elements with the given tag name.

JavaScript's getElementsByTagName() function is called to return the appropriate elements when this expression is used.

jQuery( "element" )
version added: 1.0
Examples:

Finds every DIV element.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>element demo</title>
  <style>
  div, span {
    width: 60px;
    height: 60px;
    float: left;
    padding: 10px;
    margin: 10px;
    background-color: #eee;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
  
<div>DIV1</div>
<div>DIV2</div>
<span>SPAN</span>
  
<script>
$( "div" ).css( "border", "9px solid red" );
</script>
  
</body>
</html>
doc_jQuery
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.