• js



    //日历插件
    $('.date-picker').datepicker({
    format: "yyyy-mm-dd",
    todayBtn: "linked",
    clearBtn: true,
    language: "zh-CN",
    todayHighlight: true,
    orientation: "bottom auto",
    autoclose: true
    });

    $(document).ready(function () {

    $("#adEditForm").validate({
    errorPlacement: function (error, element) {
    var eid = element.attr('name');
    console.log(eid);
    console.log(element);
    if (element.is('#adName')){
    console.log(error);
    error.appendTo(element.parent());
    }else if (element.is("#adDesc")){
    error.appendTo(element.parent());
    }else if (element.is("#startTime")){
    error.appendTo(element.parent());
    }else if (element.is("#endTime")){
    error.appendTo(element.parent());
    }else {
    error.insertAfter(element);
    }
    },
    onfocusout: function (element) {
    var checkValid = $(element).valid();
    if (false == checkValid){
    $("#save").attr("disabled", true);
    }
    },
    rules: {
    adName: {
    required: true,
    minlength: 1,
    maxlength: 24,
    },
    // adDesc: {
    // required: false,
    // minlength: 0,
    // maxlenght: 400,
    // },
    startTime: {
    required: true,
    },
    endTime: {
    required: true,
    },
    adUploaderImage: {
    required: true,
    },
    },
    messages: {
    adName: {
    require: '广告名称需为1-24个字符',
    minlength: '广告名称需为1-24个字符',
    maxlength: '广告名称需为1-24个字符',
    },
    // adDesc: {
    // require: '广告描述需为0-400个字符',
    // minlength: '广告描述需为0-400个字符',
    // maxlength: '广告描述需为0-400个字符',
    // },
    startTime: {

    },
    endTime: {

    },
    adUploaderImage: {
    require: '请上传图片',
    },
    },
    success: "valid"
    });

    $("#adName").focus(function () {

    });

    $("#save").click(function () {
    var isValidSuccess = $("#adEditForm").valid();
    if (!isValidSuccess) {
    $("#save").attr("disabled", true);
    return;
    }
    })
    });
  • 相关阅读:
    情报分析技术领域主要研究人员
    《Dynamic Topic Detection and Tracking: A Comparison of HDP, C-Word, and Cocitation Methods》笔记
    Adobe Acrobat 9 Pro 注册码
    文件访问被拒绝 需要管理员权限
    批量文件重命名工具-极力推荐 advanced renamer
    Discuz登录慢、退出也慢的原因?
    一些需要阅读的论文
    webview上传图片
    自定义圆形图片
    touch ImageView
  • 原文地址:https://www.cnblogs.com/kpengfang/p/5846738.html
Copyright © 2020-2023  润新知