zoukankan      html  css  js  c++  java
  • 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;
    }
    })
    });
  • 相关阅读:
    KCF目标跟踪方法分析与总结
    C# 事件
    委托学习(3)
    委托学习(2)
    委托学习(1)
    本地无sqlserver服务下操作数据库 之GSQL
    unity Android 打包后读取 xml 文件
    Unity 3D 调用摄像头捕获照片 录像
    Unity 进度条3D制作(3D版)
    Unity 3D 进度条制作
  • 原文地址:https://www.cnblogs.com/kpengfang/p/5846738.html
Copyright © 2011-2022 走看看