jquery datepicker删除.ui-state-highlight类onSelect事件 [英] jquery datepicker remove .ui-state-highlight class onSelect event
问题描述
我正在开发Web应用程序,在这个应用程序中我使用了jquery datepicker插件。我使用datepicker作为内联datepicker。当我选择一个日期时,我试图删除一个css类 ui-state-highlight
,但没有反映在datepicker中。
I am developing the web application, in this application i used the jquery datepicker plugin. I am using the datepicker as inline datepicker. when i select a date, i am trying to remove a css class ui-state-highlight
, but not reflected in datepicker.
$("#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
)仍然存在,请建议我一个解决方案。
When i see the console console.log($(this));
, it has been removed, but when i inspect, the css class( ui-state-highlight
) is still there, please suggest me a solution.
提前致谢。
推荐答案
尝试
inst.dpDiv.removeClass('ui-state-highlight');
inst.dpDiv
是datepicker div已生成。
inst.dpDiv
is the datepicker div that is generated.
http://jsfiddle.net/ abhMH / 2 /
这篇关于jquery datepicker删除.ui-state-highlight类onSelect事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!