我怎麼做做多的jQuery事件的新方式,現場活動(新內容時注射):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
}
});
這不是我一直在尋找的東西,我的錯,我編輯了這個問題,使其更清晰。 – Smickie 2010-02-24 11:38:20
@Smickie:在更新了我的答案之後,我已經更新了我的答案,請參閱我的答案中的編輯部分,謝謝:) – Sarfraz 2010-02-24 11:48:44