# Best way to add custom onclick handler to select options

**URL:** <https://www.ruby-forum.com/t/best-way-to-add-custom-onclick-handler-to-select-options/154694>\
**Category:** Rails\
**Created:** [December 3, 2008, 1:45am UTC](https://www.ruby-forum.com/t/best-way-to-add-custom-onclick-handler-to-select-options/154694 "2008-12-03T01:45:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [December 3, 2008, 1:45am UTC](https://www.ruby-forum.com/t/best-way-to-add-custom-onclick-handler-to-select-options/154694/1 "2008-12-03T01:45:16Z")

</div>

All,

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
