Ale*_*ith 4 jquery jquery-ui jquery-ui-datepicker
有谁知道将jquery-ui datepicker的输入分成3个独立框的优雅方式?
默认情况下,它的输入只是一个文本框: DD/MM/YYYY
我必须输入分成了日,月,年的3分独立的:DD, MM,和YYYY.
您可以使用该datepicker函数onClose然后获取值.
这只有dateFormat在数组索引正确引用时才有效,即在我的例子中,它工作于day = index 0,month = index 1,year = index 1.同样在我的例子中,我只是将值分配给spans'
小智 5
<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]);
}
})
Run Code Online (Sandbox Code Playgroud)
工作示例http://jsfiddle.net/jomanlk/7NgpQ/
| 归档时间: |
|
| 查看次数: |
9476 次 |
| 最近记录: |