為什么我再設置為mouseover事件,修改屬性attr("disabled",false),鼠標移入的時候沒有反應,false加上“”也沒有效果。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
? ? <head>
? ? ? ? <title>live()方法綁定事件</title>
? ? ? ? <script src="http://libs.baidu.com/jquery/1.8.2/jquery.js" type="text/javascript"></script>
? ? </head>
? ? <body>
? ? ? ? <h3>live()方法綁多個事件</h3>?
? ? ? ??
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? $(function () {
? ? ? ? ? ? ? ? $("#btntest").live("click mouseout", function (){
? ? ? ? ? ? ? ? ? ? $(this).attr("disabled", "true");
? ? ? ? ? ? ? ? })
? ? ? ? ? ? ? ? $("#btntest").bind("mouseover",function(){
? ? ? ? ? ? ? ? ? ? $(this).attr("disabled",false);
? ? ? ? ? ? ? ? })
? ? ? ? ? ? ? ? $("body").append("<input id='btntest' type='button' value='點擊或移出就不可用了' />");
? ? ? ? ? ? });
? ? ? ? </script>
? ? </body>
</html>
2016-07-04
disabled,設置成false即表示為可用,怎么觀察得到效果,可以分開每個事件進行測試,不用一下子全寫上去試
2016-07-04
應該是onmouseover