简体   繁体   English

在输入类型=“日期”中更改错误消息“无效日期”

[英]Change error message “invalid date” in input type=“date”

Is there a way to change the default message "Invalid date" by the french equivalent "Date invalide" for an input type="date" in HTML or JS/JQuery. 有没有一种方法可以将HTML或JS / JQuery中的输入类型=“ date”的默认消息“ Invalid date”更改为法语等效项“ Date invalide”。

Thanks ! 谢谢 !

You could use this 你可以用这个

<input type="date" oninvalid="setCustomValidity('Date invalide')" />

It's pretty well supported 很好的支持

to change the default validation message refer this code <input type="date" oninvalid="setCustomValidity('Date Invalid ')" onchange="try{setCustomValidity('')}catch(e){}" /> 要更改默认验证消息,请参考以下代码<input type="date" oninvalid="setCustomValidity('Date Invalid ')" onchange="try{setCustomValidity('')}catch(e){}" />

hope this is what you are asking for there is a bug with george's ans which is seen when you give wroung input once and re edit to enter the correct one and submit the form 希望这是您要的内容,并且只有一次输入错误并重新编辑以输入正确的内容并提交表格时,才会看到乔治ans的错误。

我建议您使用此civem.js脚本“ 自定义输入验证错误消息”脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM