html - Html输入属性不起作用
问题描述
我有一个表单,其中 input type="email" & input type="password" 在提交表单时都具有必需的属性,电子邮件未经验证(它接受简单的文本,例如'abcde'),并且两个字段也接受尽管写入了必需的属性,但为空值
<form>
<div>
<input type="radio" name="role" value="tbl_staff_details" checked />Institute/Branch
<input type="radio" name="role" value="tbl_student_details" />Student/Parent
<div id="msg" style="color: red;margin-top: 1%"></div>
</div>
<div class="form-group has-feedback" style="margin-top: 5%">
<input type="email" class="form-control" placeholder="Email" id="mail" required />
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password" id="pwd" required />
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
<label>
<input type="checkbox"> Remember Me
</label>
</div>
</div>
<!-- /.col -->
<div class="col-xs-4">
<button type="button" class="btn btn-primary btn-block btn-flat" id="signin">Sign In</button>
</div>
<!-- /.col -->
</div>
解决方案
您描述的检查将在提交表单时进行。
您没有提交按钮。
移除type="button"
(以便按钮元素使用默认值type="submit"
)。
推荐阅读
- javascript - 如何在 javascript 中翻译 Go des 代码
- gremlin - 在 Gremlin 中创建从一个遍历到另一个遍历的边
- reactjs - Jest 参数化测试 - 如果条件在里面
- azure-cosmosdb - 用于配置备份配置的 ARM 模板
- ios - wkWebview 跨界 swift IOS
- python - 无法在 PYTHONPATH 中设置路径
- python - 为什么每当我尝试执行 F 字符串时我的代码都不起作用
- python - 在 python/pandas 中连接文本和数字
- c - 使用宏的 C 枚举
- c++ - 需要在 C++ 程序中询问汽车制造商