I know that you can set startdate when initializing your datepikers in the configuration settings. I have not found a way to add an attribute inside html input to do this.
The way I got around this was like that.
$('.date-picker').each(function () {
if($(this).attr("startdate") !== undefined) {
$(this).datepicker({ format: "dd/mm/yyyy", weekStart: 0, autoclose: true, startDate: $(this).attr("startdate") });
}
else {
$(this).datepicker({ format: "dd/mm/yyyy", weekStart: 0, autoclose: true });
}
});
I write this in Razor with the following
@Html.TextBoxFor(model => model.SomeDate, new { @class = "date-picker", @data_date = "12-02-2012", @startdate = "12-04-2012" })
Can anyone suggest the right way?
This works for me, which is cool now, it adds a disabled css class to anything until date 12-04-2012.
source
share