zoukankan      html  css  js  c++  java
  • BootStrap Validator

    表单验证,必须有Form表单,需要用到form-group 

    如果使用了 input-group 无法显示出 校验提示

    <div class="input-group">
      <span class="input-group-addon">姓名</span>
      <input type="text" id="username" class="form-control" value="${username}" placeholder="姓名">
    </div>

    引入:

    <script src="~/Scripts/jquery-1.10.2.js"></script>
    <script src="~/Content/bootstrap/js/bootstrap.min.js"></script>
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Content/bootstrapValidator/js/bootstrapValidator.min.js"></script>
    <link href="~/Content/bootstrapValidator/css/bootstrapValidator.min.css" rel="stylesheet" />

    <form>
    <div class="form-group">
    <label>Username</label>
    <input type="text" class="form-control" name="username" />
    </div>
    <div class="form-group">
    <label>Email address</label>
    <input type="text" class="form-control" name="email" />
    </div>
    <div class="form-group">
    <button type="submit" name="submit" class="btn btn-primary">Submit</button>
    </div>
    </form>

    $(function () {
    $('form').bootstrapValidator({

            message: 'This value is not valid',
     feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
             },
    fields: {
    username: {
    message: '用户名验证失败',
    validators: {
    notEmpty: {
    message: '用户名不能为空'
    }
    }
    },
    email: {
    validators: {
    notEmpty: {
    message: '邮箱地址不能为空'
    }
    }
    }
    }
    });
    });

  • 相关阅读:
    如何获取QQ的clientkey
    自动输入QQ密码
    Ext Tree 操作类
    QQ消息记录文件压缩方法
    见过最恶心的代码,发泄一下。。。
    今天尝试获取QQ的clientkey未果,做个记号
    用c# 调用并调试c++的代码
    托盘管理 隐藏/显示/单击/右键/双击/改变位置
    在XP下是可以查看进程命令行参数的
    充分利用你的“二脑”
  • 原文地址:https://www.cnblogs.com/taiguyiba/p/11993127.html
Copyright © 2011-2022 走看看