0
votes

If I do:

$datePicker.datepicker('setDate', null);

the underlying input field does not get set to any specific date, but the datepicker widget selects the current date automatically.

jsfiddle

If I try:

$datePicker.datepicker('setDate', "01-01-2014");

it will populate the date field. The same goes for setting defaultDate on the datepicker options.

jsfiddle

Is there any way to set the widget to a date without having the field populated?

1

1 Answers

0
votes

I updated your JSFiddle to work with a textbox rather than a div. As per jqueryui documentation:

defaultDateType: Date or Number or String Default: null Set the date to highlight on first opening if the field is blank.

Which means:

$('#date').datepicker({ defaultDate: '01/01/2015' });