LearningRoR
LearningRoR

Reputation: 27222

Chosen Plug-in still not working

I'm trying to use the Chosen jquery plugin, i have all the right files but i can't call the function correctly. I took a look at the java error console, it loads but i get the error:

Error: $(".chzn-select").chosen is not a function
Source File: http://localhost:3000/javascripts/application.js?1312657233

This is my application.js( the only thing inside of it):

jQuery(function($){
    $('.chzn-select').chosen();
});

This the form code i am using:

<%= select("user_product", "product_id", Product.all.collect {|p| [ p.name, p.id ] }, {},{:class=>'chzn-select'}) %>

javascript folder:

application.js
chosen.jquery.js
jquery_ujs.js
jquery.js
jquery.min.js
jquery.tokeninput.js

How do i call this correctly so i can get this working or maybe a change in my form?

Upvotes: 3

Views: 2672

Answers (1)

dee-see
dee-see

Reputation: 24088

Check your app/view/layout/application.html.erb view and add <%= javascript_include_tag "chosen.jquery" %> and <%= javascript_include_tag "jquery.min" %>. It should include what's missing.

Upvotes: 2

Related Questions