Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set css class for Rails date_select year select?

I have this bit of code:

= f.date_select :dateofbirth, :start_year => Date.current.year, :end_year => 1930, :html=>{:class => "choose_dateofbirth"} 

where I'd like to set a class to the year select only, can that be done and if so - how?

Note that at current state it doesn't set any class to any select field.

like image 390
Xeen Avatar asked Dec 17 '25 15:12

Xeen


1 Answers

this should work

= f.date_select :dateofbirth, {:start_year => Date.current.year, :end_year => 1930}, {class: "choose_dateofbirth"}

docs

date_select(object_name, method, options = {}, html_options = {})
like image 162
Said Kaldybaev Avatar answered Dec 19 '25 05:12

Said Kaldybaev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!