【发布时间】: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