188
rated 0 times
[
191]
[
3]
/ answers: 1 / hits: 113050
/ 11 Years ago, wed, july 17, 2013, 12:00:00
I need your help,
How can I, using jQuery,
Change the background color of the selected row in my table (for this example, let's use the the css class highlighted
and if the same row is clicked on again, change it back to its default color (white) select the css class nonhighlighted
<!DOCTYPE html>
<html>
<head>
<style type=text/css>
.highlighted {
background: red;
}
.nonhighlighted {
background: white;
}
</style>
</head>
<body>
<table id=data border=1 cellspacing=1 width=500 id=table1>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
More From » jquery