/**
 * 表单统一验证
 *
 * @author CaiAoLin
 * @date 2017/9/29
 * @version
 */
$(document).ready(function() {
    $("form").validate({
        rules: rule === undefined ? {} : rule,
        messages: message === undefined ? {} : message,
        errorPlacement: function(error, element) {
            $(element).addClass('is-invalid');
            $(element).after(error);
        },
        errorClass: "invalid-feedback",
        errorElement: "div",
        highlight: false,
        success: function(element) {
            $(element).prev('input').removeClass('is-invalid');
            $(element).remove();
        },
    });


    $("button[type='submit']").click(function() {
        $("form").valid();
    });
});
