摘要:
jQuery中可用于事件代理的函数有 .live(), .delegate(), .on()等,其中.live()在jQuery早期版本中就存在了,但是由于其存在的诸多问题(具体可查看官方文档),现已不推荐使用。总的来说,delegate()和on()差不多是等效的,只不过on()是1.7版本新添加的,官方可能以后会优先发展on()的扩展功能。 而在delegate()官方文档页面有一段话:Since the .live() method handles events once they have propagated to the top of the document, it is ... 阅读全文
摘要:
From http://danwebb.net/2008/2/8/event-delegation-made-easy-in-jqueryI’m having a lot of fun poking around jQuery at the moment and came up with a cool little thing that’s going into Low Pro for jQuery but is a nice stand-alone little snippet for implementing event delegation. Since the Christian an 阅读全文