javascript - How to Replace all my live() functions to on() function -


this question has answer here:

as jquery 1.9 deprecated live() function,so have change alternative on().

everything seems fine.

in project using >100 live() functions.they should work great if go there each place , change on().

is there efficiant way or script use on() function,where ever using live() ??

this save lots of time.

please suggest other options too.

thank.

may can tweak lil bit!

just extend jquery .live() function own internally points .on().

    (function(jquery) {         // store reference original remove method.         var originalonmethod = jquery.fn.on;          // define overriding method.         jquery.fn.live = function() {             // event bind elements added dynamically well.              if(typeof arguments[0] == "string" && typeof arguments[1] == "function"){                 $(document).on(arguments[0], this.selector, arguments[1]);             }else{//applied when proper live syntax not followed , event not fire dynamically added elements                   originalremovemethod.apply( this, arguments );             }          }     })(jquery); 

i created function , tested, works never know breaks. reply if needs coagulate. thanks! :-)


Comments