I'm trying to set a range for a jquery datepicker that I have on my form but when I open the form it allows me to select any date.
<input class="span2 datepicker" name="tw#local#changeRequest#DeliveryDate" type="text" id="dp1">
<!-- jQuery -->
<script type="text/javascript" src="<#=tw.system.model.findManagedFileByPath('jquery-1.7.2.min.js', TWManagedFile.Types.Web).url;#>"></script>
<!-- Datepicker Script -->
<script type="text/javascript" src="<#=tw.system.model.findManagedFileByPath('bootstrap-datepicker_new.js', TWManagedFile.Types.Web).url;#>"></script>
<script type="text/javascript">
$(document).ready(function(){
$( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });
});
</script>
As far as I know, it should be done like this:
$("#datepicker").datepicker('option', {minDate: <some date>, maxDate: <some date>});
What you are missing is that you should set them using 'option'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With