Bootstrap datepicker disabling past dates without current date

前端 未结 20 2172
[愿得一人]
[愿得一人] 2020-11-27 04:55

I wanted to disable all past date before current date, not with current date. I am trying by bootstrap datepicker library \"bootstrap-datepicker\" and using following code:<

20条回答
  •  时光取名叫无心
    2020-11-27 05:47

    HTML

    
    

    JS

    jQuery(function() {
      var datepicker = $('input.datepicker');
    
      if (datepicker.length > 0) {
        datepicker.datepicker({
          format: "mm/dd/yyyy",
          startDate: new Date()
        });
      }
    });
    

    That will highlight the default date as 4/26/2015 (Apr 26, 2015) in the calendar when opened and disable all the dates before current date.

提交回复
热议问题