事件
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" class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="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>
點擊查看更多內(nèi)容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦