我正在开发web应用程序,在这个应用程序中我使用了jquery datepicker插件。我正在使用datepicker作为内联datepicker。当我选择一个日期,我试图删除一个css类ui-state-highlight
,但没有反映在datepicker。jquery datepicker remove .ui-state-highlight class onSelect event
$("#start_date").datepicker({
beforeShowDay: greySelectedDateRange,
maxDate: 0,
onSelect: function (dateText, inst) {
console.log(dateText);
var toDaysDate = getCurrrentDate('mdy'); //function returning current date
console.log(toDaysDate);
//When the selected date is equal to current date
if (dateText == toDaysDate) {
$(this).find('a.ui-state-active')
.removeClass('ui-state-highlight')
.find('.ui-datepicker-today a'));
//$(this).datepicker("refresh");
//console.log($(this));
}
}
});
当我看到控制台console.log($(this));
,它已被删除,但是当我检查,CSS类(ui-state-highlight
)仍然存在,请建议我一个解决方案。
在此先感谢。
如果这是你想要做的,我会改变这个问题,“在jquery日期选择器”删除今日日期的突出显示(即“UI状态高亮”类)。我搜索了很长时间才找到这个答案。 –