Problem with use of .parents()
I've the following situation
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td><a class=little></a></td>
</tr>
<tr>
<td><a class=little></a></td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td><a class=little></a></td>
</tr>
<tr>
<td><a class=little></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
I'd like to set the highlighted tables' opacity to 0.8 using .parents() on $("a.little").
While the following code is working fine...
<script>
$(function() {
var littlobj= $("a.little");
littlobj.each(function (){
$(this).parents().eq(3).css('opacity', '0.8');
});
});
</script>
...this code doesn't work:
<script>
$(function() {
var littlobj= $("a.little");
//
littlobj.parents().eq(3).css('opacity', '0.8');
//
});
</script>
Why is this second code wrong? What's the difference between the firs and the second form?
Thanks,
Fabio.