Search the Community
Showing results for tags '.live replace with .on'.
-
I am trying to bind dynamic event but i am not able to bind. previously i have used .live in our system that was working find now we are going to migrate our system to jquery 3.1.1. and i have replace all .live to .on function but work. for you reference.. <html> <head> <script src="jquery-3.1.1.min.js"></script> <!-- <script src="jquery-1.8.1.min.js"></script> --> <script> var abcHandler = function() { var h=this; h.getControl = function(cntrl) { return $("[class$='Cntrl_" + cntrl + "']"); }; h.main = h.getControl('main'); h.divid1 = h.getControl('divid1'); h.divid2 = h.getControl('divid2'); } abcHandler.prototype.BindEvents = function() { var h=this; h.main.append("<a class='Cntrl_divid1' href='#'>View Details1</a><br />"); h.main.append("<a class='Cntrl_divid2' href='#'>View Details2</a>"); h.divid1.click(function () { alert(this.innerHTML); }); h.divid2.click(function () { alert(this.innerHTML); }); }; var handler; $(document).ready(function() { handler = new abcHandler(); handler.BindEvents(); }); </script> </head> <body> <div class="Cntrl_main"> </div> </body> </html> Please suggest me how i can fix this issue. das
- 2 replies
-
- Jquery migrate jquery-1.8.1.m
- .live replace with .on
- (and 1 more)