0
我想改變點擊的UL LI鏈接與jquery;它只適用於懸停事件,不適用於點擊事件。請參閱下面我的代碼:試圖chage UL LI背景顏色jquery
$("nav ul li").hover(function() {
$(this).find('a').css('color', '#FF0');
}, function() {
$(this).find('a').css('color', '#FFF');
});
$("nav ul li").click(function() {
$(this).find('a').css('color', '#FF0');
$(this).find('a').siblings().css('color', '#FFF');
});
對不起,我的意思是改變鏈接的顏色... – user2725341
$(this).find('a')。siblings()'可能會匹配比你想要的更多的元素。你能詳細說明你想達到什麼,所以我們可以提出更好的解決方案嗎? (發佈你的標記的例子也有幫助。) –
你可以發佈相關的標記嗎? – billyonecan