jQuery的监测事件
如何对一系列dom元素绑定事件? 那些元素在后续操作中还有可能会增加。 prototype.js中可以使用Event.Observe, jQuery中怎么做呢? 参考如下: 使用jquery中的事件检测而不事先绑定。 http://www.beyondstandards.com/archives/jquery-ajax-and-event-handlers/ http://docs.jquery.com/Events/live <http://www.sitepoint.com/blogs/2008/07/23/javascript-event-delegation-is- easier-than-you-think/> function aClick() { $("div").show().fadeOut("slow"); } $("#bind").click(function () { $("#theone").live("click", aClick) .text("Can Click!"); }); $("#unbind").click(function () { $("#theone").die("click", aClick) .text("Does nothing..."); });