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 902627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:44:52+00:00 2026-05-15T15:44:52+00:00

I have the exact same problem as this guy , since no one has

  • 0

I have the exact same problem as this guy , since no one has answered, I decided to repost:

I have been trying to implement this
jquery plugin to my app.I need help
trying to output something like this

<select name="user[university_id]" id="user_university_id" class="selectable">
<option value="1" title="uni1">Uni1</option>
<option value="2" title="uni2">Uni2</option>
</select>

by using a rails helper…the problem
is the helpers never seem to output a
title attribute to the option tags..
which is critical for this plugin

please help, thanks in advance

Edit: my current rails code is

<%= f.collection_select(:university_id,University.all,:id,:name)%

which simply outputs

<select name="user[university_id]" id="user_university_id">
        <option value="1">Uni1</option>
        <option value="2">Uni2</option>
    </select>

So basically what I need is a way to
also add title attribute to my
options.

  • 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-05-15T15:44:53+00:00Added an answer on May 15, 2026 at 3:44 pm

    Have you thought about rolling your own helper? I just copied this code out of the rails source and then changed the name and added the title.

      def options_for_select_with_title(container, selected = nil)
        return container if String === container
    
        container = container.to_a if Hash === container
        selected, disabled = extract_selected_and_disabled(selected)
    
        options_for_select = container.inject([]) do |options, element|
          text, value = option_text_and_value(element)
          selected_attribute = ' selected="selected"' if option_value_selected?(value, selected)
          disabled_attribute = ' disabled="disabled"' if disabled && option_value_selected?(value, disabled)
          options << %(<option title="#{html_escape(value.to_s.downcase)}" value="#{html_escape(value.to_s)}"#{selected_attribute}#{disabled_attribute}>#{html_escape(text.to_s)}</option>)
        end
    
        options_for_select.join("\n").html_safe
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the exact same problem as the guy who wrote this question. The
I have the exact same problem as described in this post (event content /
I have the exact same problem as this post . I want my custom
I have implement the exact same concept for my project- http://blog.perplexedlabs.com/2009/05/04/php-jquery-ajax-javascript-long-polling/ My question is,
I have tomcat 6.0.18 running on one server without a problem. With the exact
I have almost the same problem as this unanswered question . The only difference
I have been trying to make this search engine for a MySQL database. Taking
To make this easier to understand, I will present the exact same problem as
I'm having the exact same problem as in this question: Gray border when using
I have the exact same html sitting on two different servers. Both pages call

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.