Reputation: 17
Can someone teach me how to disable dates in my js datepicker.
<script type="text/javascript">
$('.dateapick').fdatepicker({
TodayHighlight: true,
format: 'mm/dd/yyyy',
disableDblClickSelection: true,
leftArrow: '<<',
rightArrow: '>>',
});
Here's my datepicker (JS)
<asp:Textbox runat="server" ID="txtStartDate" OnTextChanged="txtStartDate_TextChanged" onchange="subtractDate(this.Id)" placeholder="MM/dd/yyyy" AutoPostBack="true" Enabled="true" CssClass="form-control pickadate"></asp:Textbox>
and this is the front where i use my date.
Upvotes: 0
Views: 186
Reputation: 22875
You can use onRender
callback and based on your condition, return disabled
or empty string
$('.dateapick').fdatepicker({
TodayHighlight: true,
format: 'mm/dd/yyyy',
disableDblClickSelection: true,
leftArrow: '<<',
rightArrow: '>>',
onRender: function (date) {
return condition ? 'disabled' : '';
}
});
Upvotes: 1