是否有一个jQuery下拉年份选择器 [英] is there a jquery dropdown year selector
本文介绍了是否有一个jQuery下拉年份选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一个jQuery插件会自动创建一个下拉年份选择器(这是一个选择"元素,其中填充了从当前年份开始并追溯到给定年份的所有年份)?
is there a jQuery plugin that creates automatically a dropdown year selector (that is a "select" element poulated with all years starting from current and dating back to a given year)?
我不需要日/月(否则我会使用日期选择器),我只需要年份!
I don't need day/month (otherwise i'd have used the datepicker), i just need the year!
预先感谢
推荐答案
那又怎么样:
<select name="yearpicker" id="yearpicker"></select>
然后:
for (i = new Date().getFullYear(); i > 1900; i--)
{
$('#yearpicker').append($('<option />').val(i).html(i));
}
这篇关于是否有一个jQuery下拉年份选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文