I have a table that looks something like this.
<table>
<thead>
<tr>
<th>Foo</th>
<th>Bar</th>
</tr>
</thead>
<tbody>
<tr class="data">
<td>Info here</th>
<td><a href"/url_here" class="edit">Edit</a></td>
</tr>
<tr class="data">
<td>More here</th>
<td><a href"/url_here" class="edit">Edit</a></td>
</tr>
</tbody>
</table>
I want to show the "Edit" link when you hover over any of the lines inside. I tried several ways to do this, but continue to run into the same problem. Assuming I'm just thinking about it wrong.
This is what I have.
$('a[class*=edit]').hide();
$('tr[class*=data]').bind("mouseover", function(e) {
$(e.target).closest('a[class*=edit]').addClass("selected");
$('a[class*=selected]:first').show();
}).mouseout(function() {
$('a[class*=selected]').hide();
$('a[class*=edit]').removeClass("selected");
})
The problem with existing code is that it does not add the selected class unless you directly point to the edit link. As I mentioned above, I need it to add the selected class when you hover over any point on this line. I also want it to display an edit link for this particular line.
, , , , , - . !