title: DOM selection in jquery
body: <p>i have a table, and i did sorting of that. Its execution time bad. I guess this is because of DOM manipulation.
  /* I m converting to array */</p>
  
  <pre><code>var rows = $table.find('tbody &gt; tr').get(); 
  
  
   $.each(rows, function(index, row){     /*then again to 2D array */
  
              if(($(row).children('td').eq(0).attr('class').indexOf('collapse') != -1 || $(row).children('td').eq(0).attr('class').indexOf('expand') != -1)){ 
                  myData.push(myData1);
                  myData1 = [];
              }
                  myData1.push(row);  
                  rowCount++;
                  if(rowCount == $(rows).length){ // to assign last group of rows
                  myData.push(myData1);
                      myData1 = [];
  
              }
     });
  </code></pre>
  
  <p>which is the best way to select the DOM elements directly thorough array. Because i am using this many times.</p>