I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the .live()
stops working.
I get the error TypeError: $(...).live is not a funct
When i will getting this error on my site .it will stop some functionality on my site, after research i find the solution for this problem ,
$colorpicker_inputs.live('focus', function(e) {
jQuery(this).next('.farb-popup').show();
jQuery(this).parents('li').css( {
position : 'relative',
zIndex : '9999'
})
jQuery('#tabber').css( {
overflow : 'visible'
});
});
$colorpicker_inputs.live('blur', function(e) {
jQuery(this).next('.farb-popup').hide();
jQuery(this).parents('li').css( {
zIndex : '0'
})
});
Should be replace 'live' to 'on' check below
$colorpicker_inputs.on('focus', function(e) {
jQuery(this).next('.farb-popup').show();
jQuery(this).parents('li').css( {
position : 'relative',
zIndex : '9999'
})
jQuery('#tabber').css( {
overflow : 'visible'
});
});
$colorpicker_inputs.on('blur', function(e) {
jQuery(this).next('.farb-popup').hide();
jQuery(this).parents('li').css( {
zIndex : '0'
})
});
One more basic exmaple below :
.live(event, selector, function)
Change it to :
.on(event, selector, function)