I am new to jQuery and I am trying to make a hover effect on my table, but I don't know how to do it. I would like to make only the text red, and then how to remove the red color again when the focus is lost.
This is what I still have:
<script type="text/javascript">
$(function() {
$('tr').hover(function() {
$(this).css('color', 'red')
});
});
</script>
<table border="1">
<tr>
<th>ID</th>
<th>name</th>
</tr>
<tr>
<td>#1</td>
<td>ole</td>
</tr>
<tr>
<td>#2</td>
<td>jeffrey</td>
</tr>
<tr>
<td>#3</td>
<td>collin</td>
</tr>
<tr>
<td>#4</td>
<td>eve</td>
</tr>
</table>
Sjmon source
share