Darcy Darcy - 2 years ago 121
Javascript Question

HTML input type=date weekdays

Is there any ways to make html input date only allow to pick weekdays calendar?
I wish to prevent past dates as well. Can i do this without using jquery datepicker?

input type="date" name="date" id="date"

Answer Source

You can prevent past dates by setting min attribute.

And I think you cannot disable the weekends with javascript.

var today = new Date().toISOString().split('T')[0];
document.getElementsByName("date")[0].setAttribute('min', today);
<input type="date" name="date" id="date">

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download