how can we define id for this rails select statement , i have tried doing in this way like
<%= f.select :state, options_for_select(Contact::STATES), :id=>"state_job" %>
but it is not showing any id when i inspect it in the browser. Please help me out
<%= f.select :state, options_for_select(Contact::STATES) %>
The select tag helper looks for options
, then html_options
, you just need to make sure your id is in the right place (html_options
) by passing something to the options
parameter:
<%= f.select :state, options_for_select(Contact::STATES), {}, {:id=>"state_job"} %>
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