Javascript 选择和引导的问题
我正试图实现可视标记,基于Railscasts事件: 由于某些原因,无法找到所选库(请参阅下面javascript控制台中的错误)。我也有点担心所有这些引导错误 application.jsJavascript 选择和引导的问题,javascript,ruby-on-rails,twitter-bootstrap,jquery-chosen,Javascript,Ruby On Rails,Twitter Bootstrap,Jquery Chosen,我正试图实现可视标记,基于Railscasts事件: 由于某些原因,无法找到所选库(请参阅下面javascript控制台中的错误)。我也有点担心所有这些引导错误 application.js //= require bootstrap //= require jquery //= require chosen-jquery //= require jquery_ujs //= require_tree . application.css *= require_self *= require c
//= require bootstrap
//= require jquery
//= require chosen-jquery
//= require jquery_ujs
//= require_tree .
application.css
*= require_self
*= require chosen
*= require_tree .
咖啡
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>
来自javascript控制台的错误消息:
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.
编辑
附加信息:我刚刚注意到在呈现的页面源中有两个指向所选库的链接
<script src="/assets/chosen.jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/chosen-jquery.js?body=1" type="text/javascript"></script>
**编辑3**
相关问题:已解决 在大量搜索和修改代码之后,我更改了config/environments/development.rb中的static assets指令
PS如果有人能解释这里发生的事情,我会接受这个答案。
<script src="/assets/chosen.jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/chosen-jquery.js?body=1" type="text/javascript"></script>
//= require jquery
//= require jquery_ujs
//= require chosen-jquery
//= require bootstrap
//= require_tree .
config.serve_static_assets = false