我正在使用jQuery來更改某些元素的CSS,而將鼠標懸停在其他元素上,並在Chrome開發人員工具中收到此錯誤: 「遺漏的類型錯誤:對象.gearImg有沒有方法 'CSS'」 這裏是我的CSS代碼:得到一個錯誤消息「未捕獲TypeError:對象.gearImg沒有方法'css'」
.gearImg{
position: absolute;
z-index: 10;
top: 2px;
right: 10px;
opacity: 0.5;
}
這裏是我的jQuery代碼:
$('#settings_div').hover(function(){
$(this).show();
alert(('.gearImg').css('opacity')); //alerting to find the problem, should show 0.5
},
function(){
$(this).hide();
('.gearImg').css('opacity', 0.5);
});
問題在哪裏?
感謝