StuBlackett
StuBlackett

Reputation: 3857

jQuery ui datepicker - Clear beforeShowDay property

I have a "select menu" that then populates my jQuery ui datepicker with the dates that are available to book.

Now what I'd like to do is when you change the select option, The beforeShowDay is cleared, To then populate it with the new data.

Is there a function that clears this when an event change is triggered? I've had a google and not really seen much.

Hopefully someone has come across this.

Thanks

Upvotes: 1

Views: 1200

Answers (1)

Abhitalks
Abhitalks

Reputation: 28397

Just fire the destroy on the datepicker field and re-attach the datepicker without the beforeShowDay option.

For example, if your datepicker is attached to a textbox called "txtDate", then

$('#txtDate').datepicker("destroy");

Then, re-attach the datepicker without beforeShowDay option:

$('#txtDate').datepicker({changeMonth: true, changeYear: true });

Put the above inside your change event handler of the select.

Upvotes: 5

Related Questions