Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 871
Strosino Avatar asked Jun 16 '11 14:06

Strosino


1 Answers

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/

like image 83
Niklas Avatar answered Oct 19 '22 09:10

Niklas