Datepicker with no selected date? [duplicate]
Possible Duplicate:
JQuery Datepicker - no default date
When no default date is given to datepicker, when opened, it highlights today as if it was selected. Is it possible to open datepicker without any date preselected?
You can't remove the defaultDate
selected, as it will always select something (if you leave it null, it will select today). However, functionality wise, it doesn't really make a difference, so one way to go around it is to just remove the selection classes from the date like this:
$( "#datepicker" ).datepicker({
beforeShow: function(input, inst) {
window.setTimeout(function(){
$(inst.dpDiv).find('.ui-state-highlight.ui-state-hover').removeClass('ui-state-highlight ui-state-hover')
},0)
},
});
example: http://jsfiddle.net/niklasvh/zhVgm/
精彩评论