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 mouse over any of the rows inside of the . I have tried a few methods of doing this, but keep hitting the same problem. Assuming I'm just thinking about this the wrong way.
This is what I currently 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");
})
Problem with the existing code is it's not adding the selected class unless you hover directly over the edit link. Like I mentioned above I need it to add the selected class when you mouse over anywhere in the that row. I also only want it to display the edit link for that specific row.
Any help would be really appreciated been pulling my hair out for a couple hours and I know it is probably something stupid. Thanks!