Select elements with a specific attribute using JQuery
Here let us assume that we have an HTML mark up as follows
[html]
<table Id="YearlyGridReport">
<tr level="1">
<td >Header Row1</td>
<th ><span>2014</span></th>
<th><span>2015</span></th>
</tr>
<tr level="2">
<td >Header Row2</td>
<th ><span>2014</span></th>
<th><span>2015</span></th>
</tr>
<tr>
<td >Header Row2</td>
<th ><span>2014</span></th>
<th><span>2015</span></th>
</tr>
……
</table>
[/html]
Now what if to select the elements with the specific attribute. You can do that in the following way.
[js]
var levelselector = $("#YearlyGridReport tr[level]");
var levelcount = levelselector.length;
[/js]