Reputation: 26690
I want to select one of options in SELECT tag with special color.
How to do this following using Rails' f.select helper and options_for_select ?
<html>
<head>
<style type="text/css">
option.standard {background-color:#FFAAAA}
</style>
</head>
<body>
<select style="width:100px">
<option selected="selected">1</option>
<option>2</option>
<option class="standard">3</option>
<option>4</option>
<option>5</option>
</select>
</body>
</html>
Upvotes: 3
Views: 3193
Reputation: 31477
As the documentation says for options_for_select
, you can do it like this:
options_for_select([ 1, 2, [ 3, { :class => 'standard' }], 4, 5 ], [ 1 ])
Upvotes: 3