使用 Javascript 在 Datepicker 中禁用以前的日期

Disable Previous Dates in Datepicker with Javascript

我是 Javascript 的新人,我想禁用今天以前的日期 我用这段代码来显示 Datepicker

<input type="text" onfocus="(this.type='date')" id="leaveTo" name="leaveTo" placeholder="DD-MM-YYYY" style="width:fit-content;">

如果我答对了你的问题,你需要将一些日期设置为不可选择。

这可以通过使用最大、最小属性来完成。

有关更多信息,请查看:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Additional_attributes

<input type="date" min="2020-12-23">