事件
click
mouseover
mouseout
focus
blur
清除所有事件:unbind();
代码示例:选择人名,2个ul,点击某一项之后,移动到另外一个ul中。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>jQuery测试</title> <style type="text/css"> ul{ list-style-type: none; } </style> <script type="text/javascript" src="js/jquery-1.12.3.js"></script> <script type="text/javascript"> $(function () { $('#u1 li').mouseover(function () { $(this).css('backgroundColor','red').siblings().css('backgroundColor',''); }).click(function () {// $(this).css('backgroundColor','').unbind().appendTo($('#u2'));//unbind() $(this).removeAttr('style').unbind('click').appendTo($('#u2'));//unbind('click')// $(this).removeAttr('style').unbind().appendTo($('#u2'));//removeAttr('style') }); }); </script></head><body> <ul id="u1"> <li>AAAAAA</li> <li>BBBBBB</li> <li>CCCCCC</li> <li>DDDDDD</li> <li>EEEEEE</li> </ul> <hr width="95%"/> <ul id="u2"> </ul></body></html>