我有一个jQuery-UI datepicker的问题,我搜索和搜索但我没有找到答案.我有以下代码:
<script type="text/javascript">
$(function() {
$("#birthdate" ).datepicker({
changeMonth: true,
changeYear: true,
yearRange: '1920:2010',
dateFormat : 'dd-mm-yy',
defaultDate: '01-01-1985'
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我希望当用户在#birthdate输入中单击当前选择的日期时01-01-1985,现在它正在设置当前日期.
我有一些关于jQuery UI日期选择器的问题.
1 - 是否有选项可以使用默认值?我想要做的是用今天的日期预填充我的输入文本类型.
2 - 如果我把type ="Date"而不是type ="Text"然后使用jquery时间选择器,我选择日期时会出现此错误.
The specified value '02/18/2015' does not conform to the required format, 'yyyy-MM-dd.'
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?