on('click', function() use less memory then .click(function() and it works on dynamically added elements.If we are using on('click', function() then we can remove this handler by using off('click', function(). The main advantage of on click is that it works on dynamically added elements. .click is the shortcut method for on click. If we are not using dynamically element then these works same for bind a handler to the click
$("divid").click(function() {
alert("Hi");
});
$("divid").on('click',function() {
alert("Hi");
});
0 Comment(s)