我试图让它有一个默认选项卡,当另一个被点击时,它将该类从该选项卡移到被点击的类上。jQuery - 添加和删除类
下面是我有HTML:
<div id="rightWrap">
<div id="headStep"><span class="titleSub">Workers</span></div>
<center>
<br>
<a href="../about/?s=architect"><table class="highlight">
</table></a>
<br>
<a href="../about/?s=broker"><table class="">
</table></a>
<br>
<a href="../about/?s=operator"><table class="">
</table></a>
<br>
<a href="../about/?s=consultant"><table class="">
</table></a>
</center>
</div>
和JavaScript:
$(document).ready(function() {
$('#rightWrap a table').click(function(){
$(this).addClass('highlight').siblings().removeClass('highlight');
});
});
为什么在锚标签内表? – nhahtdh
非常讨厌的标记 – mplungjan