J.Pip J.Pip - 1 year ago 122
Javascript Question

jquery UI datepicker reset date

I have a datepicker that's on an input field,

default date when I first open it is today's date, which is what I want.

However when I select a date and I clear the input field,

the datepicker still has the selected date on it, which I don't want :p

Does anyone has an idea why this happens and how I can prevent this behaviour?



Answer Source

See http://codepen.io/alexgill/pen/yOQrwV

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