Bind可以为元素绑定事件,也可以绑定多个事件:
绑定单事件:
$('#foo').bind('click', function() {
alert('User clicked on "foo."');
});
绑定多事件:
$('#foo').bind({ click: function() { // do something on click }, mouseenter: function() { // do something on mouseenter } });
Bind可以为元素绑定事件,也可以绑定多个事件:
绑定单事件:
$('#foo').bind('click', function() {
alert('User clicked on "foo."');
});
绑定多事件:
$('#foo').bind({ click: function() { // do something on click }, mouseenter: function() { // do something on mouseenter } });