Create list of jQuery elements as array - Javascript jQuery

Javascript examples for jQuery:Array

Description

Create list of jQuery elements as array

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from w w  w . j  ava2  s .  c  o m
$(function(){
   var arr = new Array($('#el1'),$('#el2'), $('#el3'));
   console.log( arr.length );
});
    });

      </script> 
 </head> 
 <body> 
  <div id="el1"> 
  </div> 
  <div id="el2"> 
  </div> 
  <div id="el3"> 
  </div>  
 </body>
</html>

Related Tutorials