gpt4 book ai didi

javascript - 如何删除 "Please match the requested format"

转载 作者:搜寻专家 更新时间:2023-10-31 23:17:13 26 4
gpt4 key购买 nike

如何将“请匹配要求的格式”更改为“无效”

我查看了整个 Stackoverflow 找不到任何帮助它可能是重复的但请帮助我!

如果我在字段中键入'asd',然后按GO,然后继续键入消息“请匹配所需的格式” 会出现

我不想要乱七八糟的代码,我希望它尽可能在html标签中!

<form id="banner-message">
<input value=""
name="email"
id="inputEmail"
class="form-control"
placeholder="email"
required=""
autofocus=""
oninvalid="this.setCustomValidity('Not Valid')" oninput="setCustomValidity('')"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">

<button class="btn btn-lg btn-block" type="submit">Go</button>
</form>

最佳答案

你需要使用onchangethis.setCustomValidity

  <form id="banner-message">
<input value=""
name="email"
id="inputEmail"
class="form-control"
placeholder="email"
required=""
autofocus=""
oninvalid="this.setCustomValidity('Not Valid')"
onchange="try{setCustomValidity('')}catch(e){}"
oninput="setCustomValidity(' ')"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">

<button class="btn btn-lg btn-block" type="submit">Go</button>
</form>

关于javascript - 如何删除 "Please match the requested format",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51933218/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com