在 Bootstrap 中定义“必填"字段 [英] Defining a `required` field in Bootstrap

查看:51
本文介绍了在 Bootstrap 中定义“必填"字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Twitter Bootstrap 3 中根据需要定义文本字段(带红色边框)?

required="required" 不起作用...

<div class="form-group"><label for="exampleInputEmail1">电子邮件地址</label><input type="email" class="form-control" id="exampleInputEmail1" placeholder="输入电子邮件">

<div class="form-group"><label for="exampleInputPassword1">密码</label><input type="password" class="form-control" id="exampleInputPassword1" placeholder="密码">

<div class="form-group"><label for="exampleInputFile">文件输入</label><input type="file" id="exampleInputFile"><p class="help-block">这里是块级帮助文本示例.</p>

<div class="checkbox"><标签><输入类型=复选框">对我进行检查

<button type="submit" class="btn btn-default">提交</button></表单>

解决方案

尝试在 bootstrap 3 中使用 required="true"

How do I define text field as required (with red border) in Twitter Bootstrap 3?

required="required" doesn't work...

<form role="form">
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
  </div>
  <div class="form-group">
    <label for="exampleInputFile">File input</label>
    <input type="file" id="exampleInputFile">
    <p class="help-block">Example block-level help text here.</p>
  </div>
  <div class="checkbox">
    <label>
      <input type="checkbox"> Check me out
    </label>
  </div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>

解决方案

Try using required="true" in bootstrap 3

这篇关于在 Bootstrap 中定义“必填"字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆