-1
<div id="mybutton" class="button">label</div>
<script>
$(document).ready(function() {
$('.button').mouseenter(function() {
$(this).css('cursor', 'pointer');
$(this).addClass('green');
});
$('.button').mouseleave(function() {
$(this).css('cursor', 'auto');
$(this).removeClass('green');
});
});
</script>
当我mouseenter #mybutton没有任何反应。为什么?我究竟做错了什么?jQuery事件监听器不工作
你的代码没有错。你包括Jquery库吗? –
适用于我http://jsfiddle.net/fg7ys/ –
仅供参考您在这里可以使用CSS完成的工作 – George