2

I am using the jQuery datepicker and I currently have this code:

$("#dateObj").datepicker({
    beforeShowDay: findDateAvailable
});

where findDateAvailable is a function which checks if the date is in an array and if not, makes the date not selectable.

My question is: how do I change which dates are 'active' and can be selected without changing my array and then re-creating the datepicker object?

1
  • Read the documentation Commented Apr 14, 2013 at 11:38

1 Answer 1

2

You can use the refresh method of the datepicker widget.

Redraw the date picker, after having made some external modifications. This method does not accept any arguments.

Reference here: http://api.jqueryui.com/datepicker/#method-refresh

You can use it in your script by using:

$("#dateObj").datepicker("refresh");

Working fiddle: http://jsfiddle.net/ChM6D/2/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.