Uncaught TypeError: Object [object Object] has no method 'live'

Francesca picture Francesca · Apr 25, 2013 · Viewed 22.7k times · Source

Getting this error:

Uncaught TypeError: Object [object Object] has no method 'live'

From this JavaScript and jQuery code:

init: function(options) {
  var form = this;
  if (!form.data('jqv') || form.data('jqv') == null ) {
    options = methods._saveOptions(form, options);
    // bind all formError elements to close on click
    $(".formError").live("click", function() {

      //Getting error here:
      //Uncaught TypeError: Object [object Object] has no method 'live'

    });
  }
  return this;
};

Why is method live missing?

Answer

Naftali aka Neal picture Naftali aka Neal · Apr 25, 2013

.live was removed in jquery 1.9

See DOCs: http://api.jquery.com/live/


Try using .on instead:

$(document).on('click', '.formError', function(){ 
   //your event function
});