0

I have set up a jQuery UI inline datapicker and has disallowed the present and previous dates. This automatically selects tomorrow as the default date. However, I would like to not have a date selected by default. How can I accomplish this?

        $("#datepicker").datepicker({
            inline: true,
            firstDay: 1,
            minDate: 1,
            defaultDate: ???,
        });

https://jsfiddle.net/mckeene/pe05vjcy/

1 Answer 1

1

So, it would seem it takes a bit to get it to default to nothing. Expanding on this answer: https://stackoverflow.com/a/28078137/99401 I ended up with this:

<div id="datepicker"></div>

$("#datepicker").datepicker({
  inline: true,
  firstDay: 1,
  minDate: 1,
  setDate: null
});
$("#datepicker").find(".ui-datepicker-current-day a").removeClass("ui-state-active");
$("#datepicker").find(".ui-datepicker-current-day a").removeClass("ui-datepicker-days-cell-over");
$("#datepicker").find(".ui-datepicker-current-day a").removeClass("ui-state-hover");

See here for an updated working example: https://jsfiddle.net/jreljac/rdnk9yk2/3/

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

2 Comments

Hi Jason. Here is how it looks like jsfiddle.net/mckeene/pe05vjcy
Thank you very much. Weird that it is not part of the default options.

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.