<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Validation for BootstrapjQuery表單驗(yàn)證插件

          聯(lián)合創(chuàng)作 · 2023-10-02 11:08

          首先需要引入 jQuery 和 Bootstrap 庫(kù),然后在Js代碼中加入下面一行代碼。

          $('#form').validation();
          

          $('#form') 為jQuery選中你需要驗(yàn)證的 dom 元素,最后只需要在html代碼中指定相關(guān)的屬性即可。

          <form class="form-horizontal">
              <div class="control-group">
                  <label class="control-label" for="inputEmail">郵箱</label>
                  <div class="controls">
                      <input type="text" id="inputEmail" check-type="mail" mail-message="郵箱格式不正確!" >
                  </div>
              </div>
              <div class="control-group">
                  <label class="control-label" for="inputPassword">密碼</label>
                  <div class="controls">
                      <input type="password" id="inputPassword" check-type="required" required-message="密碼不能為空!" >
                  </div>
              </div>
              <div class="control-group">
                  <div class="controls">
                      <button type="submit" class="btn">登錄</button>
                  </div>
              </div>
          </form>
          

          其中 check-type 為需要驗(yàn)證的規(guī)則,可以綁定多個(gè)規(guī)則,之間用空格隔開(kāi)。

          其中 required-message 為驗(yàn)證為通過(guò)顯示的信息,在這里 required-message 的'-'之前為前面定義的驗(yàn)證規(guī)則名稱(chēng)。

          瀏覽 22
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  丁香五月婷婷色色 | 粉嫩人妻| 久久久久久久久久久久久久久女乱 | 久久精品视频在线观看 | 激情婷婷视频 |