【问题标题】:Best In Place : Uncaught TypeError: Property 'jQuery' of object [object Object] is not a function最佳位置:未捕获的 TypeError:对象 [object Object] 的属性“jQuery”不是函数
【发布时间】:2014-01-14 00:12:43
【问题描述】:

我正在尝试在我的一个观点上实施 Best In Place Gem。但是,当我单击示例按钮时,什么也没有发生,并且 Chrome 检查会弹出错误 -

更新 你可以在这里看一个例子——>

https://fierce-meadow-1536.herokuapp.com/users/10/common_apps/6/edit

username: tester@tester.com
password: 123123

--

Uncaught TypeError: Property 'jQuery' of object [object Object] is not a function best_in_place.js?body=1:52
Uncaught TypeError: Property 'jQuery' of object [object Object] is not a function best_in_place.js?body=1:595

参考中的特定javascript(#comment上方)-->

  this.oldValue = this.isNil() ? "" : this.element.html();
    this.display_value = to_display;
    jQuery(this.activator).unbind("click", this.clickHandler);
    #Uncaught TypeError: Property 'jQuery' of object [object Object] is not a function 
    this.activateForm();
    this.element.trigger(jQuery.Event("best_in_place:activate"));
  },

这是我的 Application.js 文件 --

//= require jquery
//= require jquery_ujs
//= require chosen-jquery
//= require jquery_nested_form
//= require best_in_place
//= require_tree .

我的看法--

== best_in_place @common_app, :cover_letter, :path => user_common_app_path(@user,@common_app),  :type => :textarea

Users.js.coffee

jQuery ->
  $('.best_in_place').best_in_place()

发生了什么?

【问题讨论】:

  • 这是因为 gem 支持的 jquery 版本与您使用的不同
  • 嘿Pandurang,我尝试在较低版本的jQuery 中弹出,但错误仍然存​​在。不知道该怎么办。
  • 我最终选择了 x-editable-rails,这是一种较新的 gem,但更新频率更高。github.com/werein/x-editable-rails

标签: javascript jquery ruby-on-rails best-in-place


【解决方案1】:

我没能找到解决办法,宝石上的活动似乎已经减少了很多。

最终找到了适用于 x-editable 的 rails 适配, -- https://github.com/werein/x-editable-rails

它是新的,所以要注意它,但它运行良好,开发人员非常积极。

【讨论】:

    猜你喜欢
    • 2013-04-03
    • 2013-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 2015-01-14
    • 1970-01-01
    相关资源
    最近更新 更多