skip to Main Content

I have to be doing some thing very silly/stupid here. Been hitting my head all day trying to get jQueryUI to run in my Rails 4.2.1 application, and failed for some reason. Doesn’t seem like this should be that hard, I must be doing something stupid that I just can’t see.

I added this to the Gemfile:

gem 'jquery-ui-rails'

application.js

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require twitter/typeahead
//= require bootstrap
//= require_tree .

application.css

 *= require bootstrap
 *= require bootstrap-theme
 *= require font-awesome
 *= require jquery-ui
 *= require_self  
 *= require_tree .

Yet when I type in a window say:

$('input').draggable() 

I get back:

TypeError: undefined is not a function (evaluating '$('input').draggable()')

I can see in my Resources list that the draggable model is loaded. I see that jQuery is loaded, and can run other jQuery functions. I’m doing something stupid I’m sure, please help!!!

2

Answers


  1. Chosen as BEST ANSWER

    I ran:

    bin/rake assets:clobber
    

    and everything seemed to work??? Can anyone explain this for the answer vote;-)


  2. IIRC, there’s a typo in the jquery-ui-rails documentation that tells you to use jquery_ui, even though the correct notation is jquery.ui (note the dot, not underscore).

    Try this in your application.js:

    //= require jquery
    //= require jquery.turbolinks
    //= require jquery_ujs
    //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
    //= require turbolinks
    //= require_tree .
    

    application.css:

     *= require_tree .
     *= require_self
     *= require jquery-ui
     *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search