说明jquery的bind和on的区别

As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. For earlier versions, the .bind() method is used for attaching an event handler directly to elements.

jQuery官方文档介绍bind方式时的原话:As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. For earlier versions, the .bind() method is used for attaching an event handler directly to elements.,故我没去了解过jQuery的bind方法。

总结:用on就对了。

Was this helpful?

0 / 0

发表评论 0

Your email address will not be published. Required fields are marked *