gpt4 book ai didi

html - 为什么表单默认显示红色边框?

转载 作者:太空宇宙 更新时间:2023-11-04 12:27:23 24 4
gpt4 key购买 nike

我有以下 HTML:

  <form ng-submit="submitForm()"  method="POST">
<div class="formRow"><input type="email" placeholder="Email" ng-model="form.emailId" name="email" required></div>
<button type="submit" ngclick="Submit">Signin</button>

它默认显示红色边框。为什么?

当我在 Firefox 中检查 HTML 时,我看到了这个:

<input type="email" required="" name="email" ng-model="form.emailId" placeholder="Email" class="ng-pristine ng-invalid ng-invalid-required ng-valid-email">

有什么想法吗?

最佳答案

这可能是浏览器高亮显示。在 HTML5 中,我们有表单输入验证,您的输入类型为 email。这就是为什么如果内容不符合 email 字段要求,可能会出现红色边框。

为防止此设置 novalidate 属性到表单。

<form novalidate action="/some/action" method="POST"></form>

希望有所帮助。

novalidate在 W3C 上。

关于html - 为什么表单默认显示红色边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27923058/

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