开发者

Datepicker with no selected date? [duplicate]

This question already has a开发者_JS百科nswers here: Closed 11 years ago.

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜