As described on http://api.jquery.com/live/
:
As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers.
Right. So instead of
$('.dynamicallyCreatedElement').live('click', function(){
console.log('click');
});
I should use:
$('.dynamicallyCreatedElement').on('click', function(){
console.log('click');
});
However it does not bind event to elements created after on()
calling. So is it really better live()
method ?
Am I missing something ?