欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery綁定事件的幾種實(shí)現(xiàn)方式

 更新時(shí)間:2016年05月09日 08:59:33   作者:jerrylsxu  
這篇文章主要為大家詳細(xì)介紹了jQuery綁定事件的幾種實(shí)現(xiàn)方式,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了jQuery綁定事件多種實(shí)現(xiàn)方法,供大家參考,具體內(nèi)容如下

<html>
<head>
<meta charset="utf-8" />
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script><!--百度CDN-->
</head>

<body>
<input type="text"/>
<input type="button" value="button1"/>
<script>
$(function(){
  var text = $(":text");
  var button = $(":button");
  //調(diào)試器記錄日志 console.log("message"); 如:火狐瀏覽器,打開(kāi)FireBug(按F12)
  
  //觸發(fā)單個(gè)事件:兩種方式
  button.bind("mouseover",function(){
    console.log("移入");
  });
  button.bind({
    "mouseout": function(){
      console.log("移出");
    }
  });
  //多個(gè)事件:三個(gè)方式
  text.bind("dblclick blur",function(){
    console.log("雙擊或者失去焦點(diǎn)");
  });
  text.bind({
    "dblclick blur":function(){
      console.log("雙擊或者失去焦點(diǎn)");
    }
  });
  text.bind({
    "dblclick":function(){
      console.log("雙擊");
    },
    blur:function(){
      console.log("失去焦點(diǎn)");
    }
  });
  
  //取消事件
  text.unbind("dblclick"); //取消單個(gè)事件
  //text.unbind("dblclick blur"); //取消多個(gè)事件
  //text.unbind(); //取消全部事件
});

</script>
</body>
</html>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家繼續(xù)關(guān)注小編為大家分享的精彩文章。

相關(guān)文章

最新評(píng)論