# How to add class to date\_select helper

**URL:** <https://www.ruby-forum.com/t/how-to-add-class-to-date-select-helper/92027>\
**Category:** Rails\
**Created:** [April 14, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/how-to-add-class-to-date-select-helper/92027 "2007-04-14T21:15:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [April 14, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/how-to-add-class-to-date-select-helper/92027/1 "2007-04-14T21:15:07Z")

</div>

Hi,

I have this helper and would like to add a html class to each of the  
select box’s it generates, however I have been unable to find a way?

\<%= f.date\_select ‘date\_of\_birth’, :order =\> [:day,:month,:year],  
:start\_year =\> 1940, :end\_year =\> Time.now.year, :include\_blank =\> true  
%\>

Any suggestions?

thanks  
john

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [April 16, 2007, 4:00pm UTC](https://www.ruby-forum.com/t/how-to-add-class-to-date-select-helper/92027/2 "2007-04-16T16:00:51Z")

</div>

john wrote:

> I have this helper and would like to add a html class to each of the  
> select box’s it generates, however I have been unable to find a way?
> 
> \<%= f.date\_select ‘date\_of\_birth’, :order =\> [:day,:month,:year],  
> :start\_year =\> 1940, :end\_year =\> Time.now.year, :include\_blank =\> true  
> %\>
> 
> Any suggestions?

One technique I remember reading about here was to surround  
the selectors with a div having the appropriate class, and use  
CSS selector “. select” to set the styles.

–  
We develop, watch us RoR, in numbers too big to ignore.
