jQuery中bind函数绑定多个事件

来源:互联网 发布:视频推广软件 编辑:程序博客网 时间:2024/05/21 21:10
名人名言:道德是真理之花。——雨果

在jQuery中绑定多个事件名称是,使用空格隔开,举例如下:

$("#foo").bind("mouseenter mouseleave", function() {  $(this).toggleClass("entered");});

在1.4版本以后,也可以如下绑定

$("#foo").bind({  click: function() {    // do something on click  },  mouseenter: function() {    // do something on mouseenter  }});
原创粉丝点击