将jQuery UI datepicker分离为3个单独的文本框 [英] Separate a jQuery UI datepicker into 3 separate text boxes
本文介绍了将jQuery UI datepicker分离为3个单独的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道将jquery-ui datepicker的输入分为3个单独的框的优雅方法吗?
Does anyone know of an elegant way of separating the jquery-ui datepicker's input into 3 separate boxes?
默认情况下,其输入仅为一个文本框:DD/MM/YYYY
By default its input is just one textbox: DD/MM/YYYY
我必须将输入分为天,月和年的3个单独的输入:DD
,MM
和YYYY
.
I have to separate the input into 3 separate ones for day, month, and year: DD
, MM
, and YYYY
.
推荐答案
<input type='text' id='fullDate' name='fulldate'>
<!-- Your other HTML fields listed above -->
$('#fullDate').datepicker({
onSelect: function(dateText, inst) {
var pieces = dateText.split('/');
$('#day').val(pieces[0]);
$('#month').val(pieces[1]);
$('#year').val(pieces[2]);
}
})
工作示例 http://jsfiddle.net/jomanlk/7NgpQ/
这篇关于将jQuery UI datepicker分离为3个单独的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文