美文网首页Bootstrap-学习
BootstrapValidator 使用

BootstrapValidator 使用

作者: 白云青叶 | 来源:发表于2020-02-10 10:44 被阅读0次

基本版本:3.3.7

1、基本引入

     bootstrapValidator.min.css、bootstrapValidator.min.js

2、Javascript使用

    $('form').bootstrapValidator({

        message: 'This value is not valid',

        feedbackIcons: {

            valid: 'glyphicon glyphicon-ok',

            invalid: 'glyphicon glyphicon-remove',

            validating: 'glyphicon glyphicon-refresh'

        },

        fields: {

        name: {

                message: '验证失败',

                validators: {

                    notEmpty: {

                        message: '验证不能为空'

                    },

                    stringLength: {

                        min: 1,

                        max: 64,

                        message: '验证长度必须在1到64位之间'

                    }

                }

            },

            keywords: {

            message: '关键字不能为空',

                validators: {

                    notEmpty: {

                        message: '关键字不能为空'

                    }

                }

            },

           desc: {

            message: '概要不能为空',

                validators: {

                    notEmpty: {

                        message: '概要不能为空'

                    }

                },

                stringLength: {

                min:30,

                    max: 256,

                    message: '备注长度长度必须小于256'

                }

            }

        }

    }).on('success.form.bv', function(e) {

           //TO DO something

    })

    

相关文章

网友评论

    本文标题:BootstrapValidator 使用

    本文链接:https://www.haomeiwen.com/subject/bxtaxhtx.html