zoukankan      html  css  js  c++  java
  • 简易表单验证

    本来是用的其他网站扒下来的验证,结果因为JS压缩问题无法实现,于是就在他的基础上,自己做了简易验证,代码来一波

    <input type="text" id="login_merchant_id" class="input input_white" name="key_uni" placeholder="请输入商户ID"  autocomplete="off"  onkeypress="return handleEnter(this, event)">
    <span id="login_merchant_id_span" class="input_tips">请输入6位的商户ID</span>

    span是提示信息,html里就给他写好,然后给个.input_tips{display: none;}


    然后下面blur触发验证

    $("#login_merchant_id").blur(function(e){
            var val = $("#login_merchant_id").val();
            if(val.length !=6){
                    $("#login_merchant_id").next().css("display","block");
            }
            else{
                    $("#login_merchant_id").next().css("display","none");
            }
    });
  • 相关阅读:
    /etc/fstab 文件解释
    CRLF和LF
    Git远程操作详解
    jsp错误处理
    jsp隐式对象
    关于循环队列要注意的
    JSP动作元素
    JSP指令
    jsp语法简介
    jsp声明周期
  • 原文地址:https://www.cnblogs.com/samtrybest/p/5071219.html
Copyright © 2011-2022 走看看