jquery-fileupload-rails icon indicating copy to clipboard operation
jquery-fileupload-rails copied to clipboard

fileupload() is not function

Open raoaamirmuhammad opened this issue 6 years ago • 4 comments

I have the following jquery gems in my Gemfile gem 'jquery-rails' gem "jquery-ui-rails" gem 'jquery-fileupload-rails'

I added in my application.js //= require jquery-fileupload/basic

Form is <%= form_with model: @xyz, html: { multipart: true, id: "fileupload" } do |f| %> <% end %>

and the script is <script> $(function() { $('#fileupload').fileupload(); }); </script>

I got error Screenshot from 2019-09-17 10-21-34

I am using activestorage, not carrierwave Can anyone help me here

raoaamirmuhammad avatar Sep 17 '19 05:09 raoaamirmuhammad

Have you also required jquery above jquery-fileupload in application.js?

felixbuenemann avatar Sep 20 '19 15:09 felixbuenemann

Yes I required the following jquery before jquery-fileupload //= require jquery3 //= require jquery-ui

raoaamirmuhammad avatar Sep 21 '19 16:09 raoaamirmuhammad

I also required jquery-fileupload but didn't work

raoaamirmuhammad avatar Sep 23 '19 03:09 raoaamirmuhammad

The error message shows jquery-1.12.4.js, but you said you require jquery3 which is jQuery 4.3.1 in the latest version of jquery-rails, so I think you are loading another copy of jQuery with some other vendored script and that is causing the problem.

Check your assets in chrome devtools, to see were the duplicate jQuery is comming from and get rid of it.

felixbuenemann avatar Sep 23 '19 10:09 felixbuenemann