简体   繁体   中英

input date must be not be greater than current date in bootstrap datepicker [dd-M-yyyy] format

my input textbox

<input  type="text" id="dateOfDiagnosisTextbox" class="form-control" />

This is my jquery

$('#dateOfDiagnosisTextbox').datepicker({
            format: "dd-M-yyyy",
            autoclose: true,
            todayHighlight: true
        });

Date of textbox should be a valid date format (dd-M-yyyy) and must be not be greater than current date otherwise system should display appropriate error message.

Here you go with jsfiddle https://jsfiddle.net/or3jabbv/

 $( function() {
    $( "#datepicker" ).datepicker({ maxDate: "now" });
 } );
$('#dateOfDiagnosisTextbox').datepicker({
     format: "dd-M-yyyy",
     autoclose: true,
     todayHighlight: true,
     endDate: new Date()
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM