I have a JQuery error after deploying my app on Heroku
I use Rails 5.2. So this error prevents all the following js code to load.
Gemfile :
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'bootstrap', '~> 4.0.0'
Application.js
//= require rails-ujs
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery.mCustomScrollbar.concat.min
//= require bootstrap
// require turbolinks
//= require_tree .
//
I precompiled my assets before deploying to heroku with :
RAILS_ENV=production bundle exec rake assets:precompile
The ERROR :
Uncaught TypeError: t.indexOf is not a function
I inspected the error, and it comes from this function :
/*!
* Sizzle CSS Selector Engine v2.3.3
* https://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2016-08-08
*/
Go to deployed page on heroku and open up the console to see the error.
Any ideas ?
This error might be caused by jQuery event aliases like .load
, .unload
or .error
deprecated since jQuery 1.8
and removed in 3.0
.
Using lower versions like 2.1
will solve your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.