问题
I have a jQuery UI calendar widget that's displayed in my web application. I'd like to be able to highlight a specific day of the month when the user performs an action. Is there any way to do this?
回答1:
HTML :
<div id="datepicker"></div>
jQuery :
$('#datepicker').datepicker({
beforeShowDay: function(date) {
if (date == myDate) {
return [true, 'css-class', 'ToolTip'];
}
}
});
You need to write a CSS class for css-class. For more information Click Here
回答2:
Use this code
//Set DatePicker to April 25,2014
$('#dateselector').datepicker("setDate", new Date(2014,4,25) );
Refer the following links for more details :
http://api.jqueryui.com/datepicker/#method-setDate
https://forum.jquery.com/topic/datepicker-simple-highlighting-of-specific-days-who-can-help-source-inside
Hope it helps.
来源:https://stackoverflow.com/questions/9075412/highlight-day-in-jquery-ui-calendar-widget