<html <head> <title>jQuery Datepicker: Disable past days</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.2.js"></script> <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> <script type="text/javascript"> $(function() { var date = new Date(); var currentMonth = date.getMonth(); var currentDate = date.getDate(); var currentYear = date.getFullYear(); $('#datepicker').datepicker({ minDate: new Date(currentYear, currentMonth, currentDate) }); }); </script> </head> <body> <p>Date: <input type="text" id="datepicker" /></p> </body> </html>
$(document).ready(function () { var date = new Date(); var currentMonth = date.getMonth(); var currentDate = date.getDate(); var currentYear = date.getFullYear(); $('#datepicker').datepicker({ minDate: new Date(currentYear, currentMonth, currentDate), dateFormat: 'yy-mm-dd' }); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)