jquery - 未捕获的类型错误 : Object [object Object] has no method 'live'

标签 jquery object jquery-validation-engine

收到此错误:

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

来自此 JavaScript 和 jQuery 代码:

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;
};

为什么缺少方法live

最佳答案

.live 在 jquery 1.9 中被删除

请参阅文档:http://api.jquery.com/live/

<小时/>

尝试使用 .on 代替:

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

关于jquery - 未捕获的类型错误 : Object [object Object] has no method 'live' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16218120/

相关文章:

javascript - 使用基于值的 jQuery 代码更改 SharePoint 列表字段颜色?

c# - 为什么 object.ToString() 存在?

javascript - Bootstrap 4 Modal with Tabs 内的 JQuery Validation Form 不会提交

javascript - 不在桌面版时隐藏 Logo

javascript - 将innerHTML 内容转换回JSON

javascript - 导航菜单消失,直到调整窗口大小

javascript - 为什么我的reduce 函数中的累加器不接受回调的返回值?

java - 在java中我可以在一个文件中有多个类/对象吗?

jQuery 表单验证引擎在 equals 上无法正常工作

javascript - 通过 <a> 标签点击验证表单