If I have 5 links. When first, if I click on a link, it should change to a different color, and then if I click on a link to another link, the color of the previous link should go to the default value, and that color of the link should change
THE CODE:
$("table#menu tr > td a[href^='#']").click(function() {
$(this).toggleClass('class1'); /
});
a.class1 { color:#000000; }
<table id="menu">
<tr>
<td><a href="#" id="link1">qwerty</a></td>
</tr> <tr>
<td><a href="#" id="link1">zyz</a></td>
</tr>
</table>
user702208
source
share