[英]How to disable days before tomorrow in jquery UI datepicker
I want to disable days before tomorrow and set tomorrow as the default but I cant.my code shows today as the default and disabled days before today. 我想禁用明天前的几天并将明天设置为默认值,但是我无法将我的代码显示为今天的默认值和今天之前的禁用日期。
view: 视图:
<input id="date_modified" type="text" class="form-control" value="">
jquery: jQuery的:
$('#date_modified').persianDatepicker({
observer: true,
format: 'YYYY/MM/DD',
maxDate: new Date(),
})
.pDatepicker('setDate');
});
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jQuery UI Datepicker - Default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $( function() { var tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1); //Following line of code is to set the default and minDate of datepicker. $( "#datepicker" ).datepicker({minDate: tomorrow,defaultDate:tomorrow}); //Following line of code is to set value of default date on text box. $("#datepicker").val($.datepicker.formatDate('mm/dd/yy', tomorrow)); } ); </script> </head> <body> <p>Date: <input type="text" id="datepicker"></p> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.