I found two great articles talking about the new function .on()
: jquery4u.com , elijahmanor.com .(我找到了两篇有关新功能.on()
精彩文章: jquery4u.com和elijahmanor.com 。)
Is there any way where the .bind()
still is better to use than .on()
?(有没有什么办法,其中.bind()
仍是优于使用.on()
)
For example, I have a sample code that look like this:(例如,我有一个示例代码,如下所示:)
$("#container").click( function( e ) {} )
You can note that I just have one item retrieved by the selector and in my case, the <div>
named #container
already exists when my page was loaded;(您可能会注意到,选择器只检索了一项,在我的情况下,加载页面时已经存在名为#container
的<div>
。)
For that sample, should .on()
be used instead of .bind()
even if I don't use the other features provided by the .on()
function?(对于该示例,即使我不使用.on()
函数提供的其他功能,也应该使用.on()
代替.bind()
吗?)