[Solved]Selecting by ID
[Solved]Selecting by ID
Hey there, I'm really struggling with this script. I have a site that is fed dynamically by database content, and I have set the database ID to be the id of tr and td element of a table.
The table has alternative rows, on the odd rows there is a button which I want to be able to display the row underneath it (which is hidden on page loading)
As sample of what one of my tables looks like is below
-
<tr>
<td>Do you consider yourself proficient in its use?</td>
<td>dfhjipfgjigf </td>
<td class="actions" id="1"> <a href=""><img src="img/plus.png" alt="plus" height="15" width="15"></a></td>
</tr>
<tr class="meta" id="1">
<td>blah</td>
<td></td> <td></td>
</tr>
The jQuery Code I have is
-
<script>
// When the page is ready
$(document).ready(function(){
$(".meta").hide();
$(".actions").click(function(){
var thidTarget = $(this).attr('id');
$(thidTarget).show();
return false;
});
});
</script>
Currently I can get the 'click' button to reveal all the hidden content, but I only want it to display the content of the table row in which the ID matches.
Hopefully you can understand what I'm trying to do.
Regards,
Alan