jQuery cannot handle events.

“When you click a button, another button is added.  When you click the new button, one more button is added again.”

I used jQuery “live( )” method to implement the action, but one day that cannot handle the click event at all. Why? I never write elaborate codes…    I see. Because I upgraded jQuery.

According to the upgrade guide for Query 1.9, “live( )” method is removed !


They remove “live( )” method from jQuery 1.9, “on( )” method should be used instead. The way to use is also changed. Though “live( )” is associated with a selector for which you want to attach an event handler before upgrading, “on( )” is associated with document object.

(旧)$(“a.foo”).live(“click”, fn);

(新)$(document).on(“click”, “a.foo”, fn);

Similarly, “die( )” method is removed, so “off( )” should be used instead to unbind event handlers. Anyways, I was surprised at the big change as I used “live( )” daily. This reminds me that release notes are very impossible.