Select elements with a specific attribute using JQuery

Here let us assume that we have an HTML mark up as follows
 
  1. <table Id="YearlyGridReport">    
  2.     <tr  level="1">    
  3.         <td >Header Row1</td>    
  4.         <th ><span>2014</span></th>    
  5.         <th><span>2015</span></th>    
  6.     </tr>    
  7.     <tr level="2">    
  8.         <td >Header Row2</td>    
  9.         <th ><span>2014</span></th>    
  10.         <th><span>2015</span></th>    
  11.     </tr>    
  12.        <tr>    
  13.         <td >Header Row2</td>    
  14.         <th ><span>2014</span></th>    
  15.         <th><span>2015</span></th>    
  16.     </tr>    
  17.        ......    
  18. </table>   
 
Now what if to select the elements with the specific attribute. You can do that in the following way.
  1. var levelselector = $("#YearlyGridReport tr[level]");  
  2. var levelcount = levelselector.length;