gpt4 book ai didi

javascript - Uncaught ReferenceError : jQuery is not defined in console for Rails 5

转载 作者:太空宇宙 更新时间:2023-11-03 17:43:46 24 4
gpt4 key购买 nike

我刚刚为我的 Ruby on Rails 应用程序安装了 jQuery UI。它运行 Rails 5。我查看了所有类似的帖子,但它们不适用于我的情况。

我的页面呈现得很好,但在 Chrome 开发工具控制台中,我收到此错误:

enter image description here

我以各种方式重新排列了 application.js 文件,但仍然出现相同的错误。这是文件:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery-ui
//= require rails-ujs
//= require html.sortable
//= require turbolinks
//= require_tree .
//= require popper
//= require bootstrap-sprockets

最佳答案

根据上面的评论,在顶部尝试 require jquery。

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require turbolinks
//= require_tree .

关于javascript - Uncaught ReferenceError : jQuery is not defined in console for Rails 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46249017/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com