I want to add class attribute to select tag in rails 3 my code is
<div >
<%= f.label :type %><br />
<%= f.select "type_id", options_from_collection_for_select(@type,
"type_id","name"),:include_blank=>true%>
</div>
My problem is that I want to add one specific class name to this select tag for validation purpose. I tried adding
:class=>"myclassname"
but it not worked for me.plz resolve my issue
You can add class attribute like this. Check select
<%= f.select "type_id",
options_from_collection_for_select(@type, "type_id","name"),
{ :include_blank => true },
{ :class => 'myclassname' } %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With