jQuery live to on, with $(this) -
i'm updating scripts working in jquery 1.9+
live
removed , have convert on
syntax. there examples on jquery documentation. documentation gives:
$(selector).live(events, data, handler); // jquery 1.3+ $(document).on(events, selector, data, handler); // jquery 1.7
so $("a").live("click", handler)
schould converted $(document).on("click","a", handler)
, on.
but how convert when have no selector
? in case inside plugin.
$(this).live("click", handler)
this not working:
$(document).on("click",$(this), handler)
--edit
i need delegation, bind
not solution. used inside plugin, code
elem.live("click", handler)
, elem
selector, , $(this)
. have no control on that.
just use
$(this).on("click", handler);
or
$(this).click(handler);
Comments
Post a Comment