I'm having a hard time in adding a class to a date in bootstrap. Here's the datepicker.
What I'm trying to achieved is put a small blue dot in the date I specified. I'm thinking of adding a class to the date. How should I do this?
I'm having a hard time in adding a class to a date in bootstrap. Here's the datepicker.
What I'm trying to achieved is put a small blue dot in the date I specified. I'm thinking of adding a class to the date. How should I do this?
Depending on the datepicker you are using you can do something like this:
Most of the date pickers have a
beforeShowDay
option. You can set a class here to add to the day you want to change.For this example im using http://eternicode.github.io/bootstrap-datepicker
An example of how to do this can be found here: jsFiddle
You will want to put the dates you want to highlight / mark into an array:
var active_dates = ["23/5/2014","21/5/2014"];
Then use the
beforeShowDay
option to check the dates against the current day being shown and then apply a class.<input type="text" id="datepicker" />
});`
The
activeClass
can be any form of CSS. In my example i have just changed the background color. In your example you could offset an image and apply it to the day.