样式化 Rails date_select 的日期字段 [英] Styling the date fields of a Rails date_select
本文介绍了样式化 Rails date_select 的日期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Rails 的表单中,日期 select
下拉菜单很简单:
In Rails' forms, date select
drop-downs are easy:
<%= f.label :my_date %>
<%= f.date_select :my_date %>
然后我得到 3 个 select
年、月和日的下拉菜单.有没有一种简单的方法可以在不使用 JavaScript 的情况下在这些 select
元素之间添加 HTML?我希望能够更好地设计和标记它们.
Then I get 3 select
drop-downs for the year, month and day. Is there an easy way to add HTML between these select
elements without using JavaScript? I want to be able to style and label them nicer.
推荐答案
将其转换为文本字段并添加 JQuery 日期选择器或类似工具.
Convert it to a text field and add a JQuery datepicker or similar.
这里有一个很好的指南,http://railscasts.com/episodes/213-calendars
Theres a good guide here, http://railscasts.com/episodes/213-calendars
这篇关于样式化 Rails date_select 的日期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文