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;
    }
    })
    });
  • 相关阅读:
    Scrum 冲刺博客第五篇
    Scrum 冲刺博客第四篇
    Scrum 冲刺博客第三篇
    ajax send()
    form action中get post传递参数的问题
    struts2 iterator中if标签的使用
    表格内容自动换行
    从js向Action传中文参数出现乱码问题的解决方法
    java开发环境搭建
    Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/
  • 原文地址:https://www.cnblogs.com/kpengfang/p/5846738.html
Copyright © 2011-2022 走看看