Bootstrap-学习

BootstrapValidator 使用

2020-02-10  本文已影响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

    })

    

上一篇 下一篇

猜你喜欢

热点阅读