在下拉列表中选择一个日期,使另一个日期成为同一日期
我想要做的是,当在第一个下拉列表中选择开始日期时,结束日期下拉列表会自动跳转到同一日期。
就像日航网站一样。最佳范例-> http://www.jal.co.jp/
我能找到的都是像下面这样的东西,但是这个这不是我想做的。
-http://stackoverflow.com/questions/1974798/javascript-how-to-make-auto-select-another-drop-down
-http://jsajax.com/EditRunDemo.aspx
-http://stackoverflow.com /questions/1966407/how-to-populate-dropdown-with-dynamic-date-based-on-2-other-dropdown-boxes
有人知道该怎么做吗? 请给我一些建议......
我正在使用rails和jquery,所以任何与它们配合的东西都会很棒!谢谢!
What I want to do is when the starting date is selected in the first dropdown, the ending date dropdown automatically jumps to the same date.
Just like in JAL website. Best Example-> http://www.jal.co.jp/
All I could find were stuffs like below but this is not what I want to do.
-http://stackoverflow.com/questions/1974798/javascript-how-to-make-auto-select-another-drop-down
-http://jsajax.com/EditRunDemo.aspx
-http://stackoverflow.com/questions/1966407/how-to-populate-dropdown-with-dynamic-date-based-on-2-other-dropdown-boxes
Does anybody know how to do this?
Please give me some advise....
I'm using rails and jquery, so anything that goes along with them would be great! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 2 个文本输入(
from_date
和to_date
),但这与下拉菜单的处理相同。它们看起来像这样:然后,使用 jquery 和 datepicker 插件,我这样做:
如您所见,我正在为 datepicker 设置日期格式选项,并检查
from_date
盒子。如果发生变化(我从日历中选择了一个日期),内容将被复制到第二个框中(to_date
)。I use 2 input with type text (
from_date
andto_date
), but it's the same deal as with a dropdown. they look like this:then, using jquery and the datepicker plugin i do this:
as you can see, I'm setting the date format options for the datepicker, and checking to see when something changes in the
from_date
box. if something changes (i picked a date from the calendar), the contents get copied in the second box (to_date
).