jQuery中bind函数绑定多个事件
在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
}
});
转自:
http://www.cnblogs.com/wangjiping/archive/2010/06/16/1759245.html
jQuery中bind函数绑定多个事件
最新推荐文章于 2023-05-24 20:05:56 发布