如何在加载时将日期选择器字段保持为空?
How do I keep the datepicker field empty on load?
我的页面上有 3 个日期选择器,所选日期存储在数据库中。如果值为空,我希望该字段为空,但它会显示今天的日期。我使用了下面的代码,
jQuery('.date-picker').datepicker({
startDate: new Date(),
autoclose: true,
todayHighlight: true,
setDate: ''
});
如何在加载时将日期选择器字段保持为空?
尝试在日期选择器选项中省略 startDate
onRender :当一天在日期选择器中呈现时会触发此事件。应该 return 一个字符串。 Return 'disabled' 禁止选择日期。
http://www.eyecon.ro/bootstrap-datepicker/
参见"Disabling dates in the past and dependent disabling."部分示例
试试这个代码
<input type="text" id="example1"/>
<script type="text/javascript">
// When the document is ready
$(document).ready(function () {
$('#example1').datepicker();
$('#example1').val("");
});
</script>
希望对您有所帮助。
这可能会有所帮助
$(document).ready(function () {
$('#text_fied_id').datepicker();
$('#text_fied_id').val("");
});
我的页面上有 3 个日期选择器,所选日期存储在数据库中。如果值为空,我希望该字段为空,但它会显示今天的日期。我使用了下面的代码,
jQuery('.date-picker').datepicker({
startDate: new Date(),
autoclose: true,
todayHighlight: true,
setDate: ''
});
如何在加载时将日期选择器字段保持为空?
尝试在日期选择器选项中省略 startDate
onRender :当一天在日期选择器中呈现时会触发此事件。应该 return 一个字符串。 Return 'disabled' 禁止选择日期。
http://www.eyecon.ro/bootstrap-datepicker/
参见"Disabling dates in the past and dependent disabling."部分示例
试试这个代码
<input type="text" id="example1"/>
<script type="text/javascript">
// When the document is ready
$(document).ready(function () {
$('#example1').datepicker();
$('#example1').val("");
});
</script>
希望对您有所帮助。
这可能会有所帮助
$(document).ready(function () {
$('#text_fied_id').datepicker();
$('#text_fied_id').val("");
});