问题
I am using jQuery datepicker in angularjs, By overriding css I am displaying orange color background to the current date
.ui-state-highlight{
background-color:orange;
}
Now the requirement is the background color of current date must be changed to red when clicked. I have tried calling a function onSelect which changes the background color in datepicker defaults,but that's not working.How to achieve this?
回答1:
You could use onSelect event to change the css of current date
onSelect: function(value, date) {
date.dpDiv.find('.ui-datepicker-current-day')
.addClass('ui-state-highlight');
}
I would recommend against using mechanism above, instead you could override .ui-datepicker-current-day
class like this
.ui-datepicker-current-day{
background-color:orange;
}
that will not require JS.
来源:https://stackoverflow.com/questions/24449323/how-to-change-the-background-color-of-current-day-in-jquery-datepicker-onclick