-2

I'm creating a website for doctor appointments, and in the form the user can select the date when he wants to go to the appointment. The problem is that the input type 'date' lets the user select past date, and still submit the form.

I want to not let the user be able to select past date, and being able to only select today date or future date (tomorrow or another date of the month).

How can I achieve that without plugins (datepicker and others)?

Mondial
  • 119
  • 1
  • 3
  • 1
    Please try to do some research before posting here. This is pretty easy to find. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date – Scott Marcus Nov 11 '18 at 19:35

1 Answers1

0

Use the min and max attributes of an input type date.

Attribute   Description
max The latest date to accept
min The earliest date to accept

<input type="date" min="1991-12-29" max="1992-01-29">
kemicofa ghost
  • 16,349
  • 8
  • 82
  • 131