Retitled: Best way to customize <option> tags in Rails

All,

(sorry, I mis-titled this post as “Best way to add custom onclick
handler to select options” and posted it before I could fix the title).

I want to make an individual in a act as an in-place
edit field.

I get how the in_place_editor works, and it appears if I simply place a
tag “around” the of interest, and then mark this tag as the
edit-in-place target, I should be good.

The trick is how do I easily decorate the tag with a

or
tag? By “decorate” I mean that the HTML output would be

The standard select() and options_for_select() helpers only take
enumerations with ids and values, they don’t allow for any customization
as to tags around the tag.

It seems like I have two options:

  1. Completely compose the options for my select “by hand.” Then I can
    do whatever I want.

  2. I could call “options_for_select” and then using some crazy regex,
    modify the output text and decorate my option of interest that way.

Was curious if anyone had some clever suggestions and would be willing
to share them with me.

Thanks,
Wes

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs