JQuery------实现鼠标摁下抬起时div背景色改变

作用:使用自定义一个按钮

代码:

<div class = 'btn'>按钮</div>

$(".btn").mousedown(function () {   $(this).css({ "backgroundColor": "#aaa" }); }).mouseup(function () {   $(this).css({ "backgroundColor": "#ccc" }); }); });