gpt4 book ai didi

css - 如何为 Rails date_select year 选择设置 css 类?

转载 作者:数据小太阳 更新时间:2023-10-29 07:56:00 26 4
gpt4 key购买 nike

我有这段代码:

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

我想将类(class)设置为仅限年份选择,这可以做到吗?如果可以,怎么做?

请注意,在当前状态下,它不会为任何选择字段设置任何类。

最佳答案

这应该可行

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

docs

date_select(object_name, method, options = {}, html_options = {})

关于css - 如何为 Rails date_select year 选择设置 css 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23329679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com