我有一些事情要做,但对我来说有点复杂。我需要你们的帮助。 事情是这样的,我在第一个输入字段上设置了 Jquery UI 日期选择器,其中包含日期 id,但是我得到的日期值 --> 03/02/2011 应该在特定格式的三个输入字段上进行解析?请参阅下面的代码:
<label>Enter Day of Arrival (in the format DD)
<input type="text" name="$DAY$" id="day" size="6" maxlength="6" />
<label>Enter Month of Arrival (in the format MM)
<input type="text" name="$MONTH$" id="month" size="6" maxlength="6" />
<label>Enter Year of Arrival (in the format YYYY)
<input type="text" name="$YEAR$" id="year" size="6" maxlength="6" />>
最佳答案
我在 fiddle 上编写了一个示例。代码如下
<input type='text' id='full' name='fulldate'>
<!-- Your other HTML fields listed above -->
$('#full').datepicker({
onSelect: function(dateText, inst) {
var pieces = dateText.split('/');
$('#day').val(pieces[0]);
$('#month').val(pieces[1]);
$('#year').val(pieces[2]);
}
})
关于jquery - 如何打破 Jquery UI 日期选择器中的日期值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5177702/