0
我想實現視覺標記,作爲基於Railscasts插曲:http://railscasts.com/episodes/258-token-fields-revised麻煩與選擇和引導
出於某種原因,所選擇的庫無法找到(請參閱從JavaScript控制檯下面的錯誤)。我也有點擔心有所有引導程序錯誤。
的application.js
//= require bootstrap
//= require jquery
//= require chosen-jquery
//= require jquery_ujs
//= require_tree .
application.css
*= require_self
*= require chosen
*= require_tree .
sentences.js.coffee
jQuery ->
$('#sentence_tag_list').chosen()
從編輯/表格視圖
<div class="sentence">
<%= f.label :tag_list, "Tags (separated by commas)" %><br />
<%= f.text_field :tag_list, label: false, :input_html => {multiple: true} %>
</div>
的Gemfile:從JavaScript控制檯
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem "bootstrap-sass", ">= 2.3.0.0"
gem 'jquery-rails'
gem 'font_awesome_rails'
gem 'chosen-rails' # for tag formatting
end
錯誤消息:
Uncaught TypeError: undefined is not a function bootstrap-transition.js:30
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-affix.js:72
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-alert.js:72
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-button.js:68
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-carousel.js:159
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-collapse.js:127
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-dropdown.js:138
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-modal.js:199
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-scrollspy.js:125
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-tab.js:114
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-tooltip.js:327
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-popover.js:38
Uncaught TypeError: Cannot read property 'fn' of undefined bootstrap-typeahead.js:295
Uncaught TypeError: Object [object Object] has no method 'chosen' sentences.js?body=1:3
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
編輯
附加信息:我只是在渲染頁面的源代碼發現兩個鏈接到選定的libray。
<script src="/assets/chosen.jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/chosen-jquery.js?body=1" type="text/javascript"></script>
當我點擊第一個,我看到一個JavaScript庫。第二個鏈接只是返回一個空白頁面。
EDIT 2
我設法通過移動去除引導錯誤需要的jQuery後引導,但仍然得到選擇的錯誤。
//= require jquery
//= require jquery_ujs
//= require chosen-jquery
//= require bootstrap
//= require_tree .
**編輯3 **
相關問題:chosen-rails error chosen is not a function
PS如果有人能解釋發生在這裏的事情,我會接受它作爲答案。 – ardochhigh