I wanna transform our javascript to jQuery due to necessary reduction of characters. This is my HTML & Javascript
var shorty = document.getElementsByName("DPdays")[0].getElementsByTagName("td")[i].id;
<tr class="DPtag" name="DPdays">
<td id="MO"> </td>
<td id="DI"> </td>
<td id="MI"> </td>
<td id="DO"> </td>
<td id="FR"> </td>
<td id="SA"> </td>
<td id="SO"> </td>
</tr>
I tried those:
var shorty = $('.DPtag > td:eq('+i+')').attr('id');
var shorty = $('[name=DPdays] > td:eq('+i+')').attr('id');
var shorty = $('[name=DPdays] > td:eq('+i+')').id;
But none works. How can I do that?
$('.DPtag > td:eq('+i+')').attr('id');
should work fine. what do$('.DPtag > td)
returns?