我試圖讓它有一個默認選項卡,當另一個被點擊時,它將該類從該選項卡移到被點擊的類上。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