javascript - Set start date and restrict dates in datepicker -
i trying set start date 14 days today. below 14 days date not selectable. need lock next 13 days not selectable.
$('#sandbox-container input').datepicker({ format: 'mm/dd/yyyy', keyboardnavigation: false, forceparse: false, startdate: new date(), autoclose: true })
<input type="text" name="productdate" id="productdate" class="form-control" maxlength="20" placeholder="date" value="{{ date('m/d/y',strtotime($productdate))}}">
var newdate = new date(); newdate.setdate(newdate.getdate() - 14); $('input').datepicker({ format: 'mm/dd/yyyy', keyboardnavigation: false, forceparse: false, mindate: newdate, startdate: newdate, autoclose: true })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.5.4/datepicker.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.5.4/datepicker.min.css" rel="stylesheet"/> <input type="text" name="productdate" id="productdate" class="form-control" maxlength="20" placeholder="date" value="">
Comments
Post a Comment