Select elements by tag name

Description

The following code shows how to select elements by tag name.

Example


<!DOCTYPE html>
<html>
<head>
<script
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
  $(document).ready(function() {<!--   w ww . ja v a 2s.co  m-->
    var wrappedElements = $("div");
    document.writeln(wrappedElements.length);
  });
</script>
</head>
<body>
  <div id="1"></div>
  <div id="2"></div>
  <div id="3"></div>
</body>
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Example »




Animation
DOM
Event
Form
List
Select
Style
Table
Utilities