Javascript 使用jQuery更改选项卡
我正在尝试更改td的点击背景色。这就是我目前使用的JavaScript:Javascript 使用jQuery更改选项卡,javascript,jquery,html,Javascript,Jquery,Html,我正在尝试更改td的点击背景色。这就是我目前使用的JavaScript: $(document).ready(function() { $('#leftHoldNav table td').click(function(){ var $this = $(this); $this.addClass('highlight'); $this.parent().siblings('table').find('td').removeClass('highlight'); }); }
$(document).ready(function() {
$('#leftHoldNav table td').click(function(){
var $this = $(this);
$this.addClass('highlight');
$this.parent().siblings('table').find('td').removeClass('highlight');
});
});
这是我为HTML所做的:
<div id="leftHoldNav">
<center>
<table cellpadding="0" cellspacing="0">
<tr>
<td onclick="loadPage('../about/info.php','#mainWrapLoad','../about/')" class="highlight">Info</td>
<td onclick="loadPage('../about/kcintl.php','#mainWrapLoad','../about/')" class="">KC Int'l</td>
<td onclick="loadPage('../about/board.php','#mainWrapLoad','../about/')" class="">Board</td>
<td onclick="loadPage('../about/dcon.php','#mainWrapLoad','../about/')" class="">D-Con</td>
</tr>
</table>
</center>
</div>
没用了,有人知道为什么吗
你不需要回到父母身边,留在兄弟姐妹身边
好了:
$('#leftHoldNav table td').click(function(){
var $this = $(this);
$this.addClass('highlight').siblings('td').removeClass('highlight');
});
你不需要回到父母身边,留在兄弟姐妹身边
好了:
$('#leftHoldNav table td').click(function(){
var $this = $(this);
$this.addClass('highlight').siblings('td').removeClass('highlight');
});
它现在似乎运转正常。非常感谢@杰克·马丁内斯,不客气!希望链接的方法是明确的…:它现在似乎运转正常。非常感谢@杰克·马丁内斯,不客气!希望链接的方法是明确的…: