All Selector – select all elements in a page- jQuery


All Selector (*) selects all the elements of the page.


All Selector – select all elements in a page with jQuery(*) Syntax

All Selector – select all elements in a page- jQuery Example

<!DOCTYPE html>
<html>
<head>
<title>jQuery All Selector(*) Example</title>
 <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js">
 </script>
<script type="text/javascript">
         $(document).ready(function(){
          $("*").css("border","4px solid black");
          $("*").css("padding","50px;");
          $("*").css("margin","5px;");
          var countTotalElement = $("*").length;
          $("body").append("<h4>Total Items Found = "+countTotalElement+" </h4>");
          });
</script> 
  
</head>	
<body>
<div> 
Div One..
</div>
<br>
<div> 
Div Two..
</div>
<p> 
Paragraph..
</p>
<span> 
Span...
</span>

</body>
</html>             

Try it »


Advertisements

Add Comment

📖 Read More