Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
61
rated 0 times [  64] [ 3]  / answers: 1 / hits: 18875  / 7 Years ago, wed, february 22, 2017, 12:00:00

How could I disable the old dates from the present date in the datepicker using a function script? Thank you!



booknow.php



        <html>
<body>
<label for=shootdate>Desired Date:</label>
<input required type=date name=shootdate id=shootdate title=Choose your desired date/>
</body>
</html>

More From » php

 Answers
8
<html>
<body>
<label for=shootdate>Desired Date:</label>
<input required type=date name=shootdate id=shootdate title=Choose your desired date min=<?php echo date('Y-m-d'); ?>/>
</body>
</html>


You can do this using PHP itself. We can easily set minimum date to today, so that user cannot select previous dates.



Or, if you need it only using jquery, give a try on this





<html>
<head>
<link rel=stylesheet href=//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.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() {
$( #shootdate ).datepicker({
minDate: 0
});
});
</script>
</head>
<body>
<label for=shootdate>Desired Date:</label>
<input required type=text name=shootdate id=shootdate title=Choose your desired date />
</body>
</html>




[#58824] Monday, February 20, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaelyn

Total Points: 619
Total Questions: 102
Total Answers: 104

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
;