HTML
CSS
JavaScript
play_arrow
HTML
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>文本框 - 表单验证</title>
  <link rel="stylesheet" href="../assets/mdui-v0.3.0/css/mdui.min.css"/>
</head>
<body>

<div class="mdui-container">
  <div class="mdui-textfield mdui-textfield-floating-label">
    <label class="mdui-textfield-label">User name</label>
    <input class="mdui-textfield-input" type="text" required/>
    <div class="mdui-textfield-error">用户名不能为空</div>
  </div>

  <div class="mdui-textfield mdui-textfield-floating-label">
    <label class="mdui-textfield-label">Email</label>
    <input class="mdui-textfield-input" type="email" required/>
    <div class="mdui-textfield-error">邮箱格式错误</div>
  </div>

  <div class="mdui-textfield mdui-textfield-floating-label">
    <label class="mdui-textfield-label">Password</label>
    <input class="mdui-textfield-input" type="text" pattern="^.*(?=.{6,})(?=.*[a-z])(?=.*[A-Z]).*$" required/>
    <div class="mdui-textfield-error">密码至少 6 位,且包含大小写字母</div>
  </div>
</div>

<script src="../assets/mdui-v0.3.0/js/mdui.min.js"></script>
</body>
</html>
CSS

    
JavaScript