Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8572563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:02:43+00:00 2026-06-11T19:02:43+00:00

I have been playing around with the jQuery-ui Selectmenu, but haven’t been able to

  • 0

I have been playing around with the jQuery-ui Selectmenu, but haven’t been able to get it to work with the grouped_collection_select. The Selectmenu works with the basic select when I set the class to “selectmenu,” which I have set the jQuery-ui to look for. Basically, I’m struggling to add Class to grouped_collection_select.

I have tried:
<%= f.grouped_collection_select(:state_id, Country.order(:id), :categories, :name, :id, :name, {:include_blank=>true, :class=>"selectmenu"})%>

and
<%= f.grouped_collection_select(:state_id, Country.order(:id), :categories, :name, :id, :name, :class=>"selectmenu")%>

I was able to add the class using $(‘#user_state_id).addClass(‘selectmenu’) in my coffeescript. However, this seemed to cause my dynamic menu from being able to update the options for my State select menu.

Any thoughts on what I’m missing here? Is there a better way to set the class for grouped_collection_select. I’ve checked the source code and the class is not being added using :class=> in grouped_collection_select.

The selectmenu:
http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/index.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:02:44+00:00Added an answer on June 11, 2026 at 7:02 pm

    grouped_collection_select takes nine arguments. If you are passing object in with the f it only takes eight arguments.

    The last argument is html_options, where you need to place the class. This will get you the class on the select form field element but not optgroup or option elements.

    <%= f.grouped_collection_select(:state_id, Country.order(:id), :categories, :name, :id, :name, { :include_blank => true }, { :class=> "selectmenu" }) %>
    

    Without the :include_blank => true it would look like this:

    <%= f.grouped_collection_select(:state_id, Country.order(:id), :categories, :name, :id, :name, {}, { :class=> "selectmenu" }) %>
    

    Which should get you:

    <select class="selectmenu" id="object_state_id" name="object[state_id]">...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been testing and playing around with jquery date picker below. http://jqueryui.com/demos/datepicker/ on
I've been playing around with subscribing elements to AJAX events in jQuery. I have
I have been playing around in PHP with it and got something to work,
I have been playing around with jQuery for a bit now, and am really
We have been playing around with the canvas element, but are encountering sluggishness on
I have been playing around with these CSS3 properties and I've been able to
I have been playing around lately with head.js but I have found a stranger
I have been playing around with indexes on MySQL (5.5.24, WinXP), but I can't
Have been playing around with linq but there is one thing I cant seem
I saw a post earlier today and have been playing around with: http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.