Tuesday, April 10, 2012

How to check current tag element in javascript?

I've a GridView with three rows like this



<tr>
<th>SlNo</th>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>


I've the following code to traverse through the rows



var GridViewRow=GridView.getElementsByTagName('tr')


Here the row length is 3.



I travese through the GridViewRow using for loop .Here how will i get the tag name of the current element ie (th or td).



If the tagname is "TH" it should return and if it is "TD" it should take the value of TD.





No comments:

Post a Comment