【发布时间】:2011-01-19 08:41:57
【问题描述】:
如何使用执行多个 jQuery 事件的新方法来执行实时事件(用于注入新内容时):
$('.foo', this).bind({
click: function() {
//do thing
},
mouseover: function() {
//do other thing
},
mouseout: function() {
//do other other thing
},
focus: function() {
//do other other other thing
}
});
例如在上面我需要任何内容与点击和所有其他事件绑定。
基本上,我试图避免写作:
$('.foo', this).live('click', function() {
//do thing
}
});
$('.foo', this).live('mouseover', function() {
//do other thing
}
});
$('.foo', this).live('mouseout', function() {
//do other other thing
}
});
$('.foo', this).live('focus', function() {
//do other other other thing
}
});
【问题讨论】:
标签: javascript jquery events binding