js implements dynamically created element binding events

  • 2021-07-04 17:54:53
  • OfStack

Newly created elements cannot be bound by traditional methods, so live method is needed.

Example:


 $('.rule').live('mouseover', function () {
     $(this).addClass("cancelable");

Related articles: