(053)jquery_事件_live
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>dom_live.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript" src="../js/jquery/jquery-1.8.3.js"></script> <script type="text/javascript"> $(function(){ $("input").live("click",function(){ $(this).attr("disabled","true"); }); $("body").append("<input id='btntest' type='button' value='点击或移出就不可用了' />"); }); </script> </head> <body> </body> </html>
与bind()方法相同,live()方法与可以绑定元素的可执行事件,除此相同功能之外,live()方法还可以绑定动态元素,即使用代码添加的元素事件
从 jQuery 1.7 开始,不再建议使用 .live() 方法。1.9不支持.live(),本节代码编辑器里的js引用版本改为了1.8。
***万事万物都有裂痕,那是光照进来的地方***

浙公网安备 33010602011771号