我正在开发一个应用程序,我想限制用户在 html 页面的 type=date 字段中手动输入日期。 我想限制用户只能从日历显示中选择日期,即 MM/DD/YYYY。
下面是html页面中的代码:
<input type="date" name="bankTrans" ng-model="orderAstro.paymentDate"
class="form-control" id="bankTrans"
ng-disabled="isDisabled" required />
还附上图像以澄清错误: Image for error clarity
最佳答案
使用以下代码行限制使用 jquery 的手动日期字段输入。
$("input[type='date']").keydown(function (event) { event.preventDefault(); });
关于javascript - 如何限制用户在日期字段中手动输入日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56784582/