Reputation: 1680
We are using a date picker inline, and I need to change the default property value of false
to true
for todayHighlight
. The problem is that we are using the datepicker inline, so I cannot set it when we initialize it from jQuery.
Here is the view:
<div class="col-sm-3">
<div class="form-group">
<label>Required By</label>
<div class="input-group date" data-provide="datepicker">
@Html.TextBoxFor(z => z.RequiredDate, "{0:yyyy-MM-dd}",
new
{
@class = "form-control datepicker"
})
<span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
</div>
I have tried this method on the $(document).ready()
, but it did not work:
$('.datepicker').datepicker("option", "todayHighlight", true);
Does anyone have any ideas on this?
Upvotes: 1
Views: 1087
Reputation: 30893
If you have not defined your DatePicker object, adjusting an option
will fail.
You could try:
$('.datepicker').datepicker().datepicker("option", "todayHighlight", true);
You can also do this like so:
$('.datepicker').datepicker({
todayHighlight: true
});
If you're still seeing issues, you will need to investigate any any alerts or errors that are being generated by your browser in it's Console.
Upvotes: 1