YuFeng

表单提交
<script> /*这里是提交表单前的非空校验*/ $(functi...
扫描右侧二维码阅读全文
09
2019/07

表单提交

<script>
        /*这里是提交表单前的非空校验*/
        $(function() {
            $("form").submit(function() {
                var first = $("input[name='username']").val();
                var last = $("input[name='password']").val();

                if (first == "" || first == null || first == undefined) {
                    alert("用户名不能为空");
                    return false;/*阻止表单提交*/
                } else if (last == "" || last == null || last == undefined) {
                    alert("密码不能为空");
                    return false;/*阻止表单提交*/
                } else {
                    alert("提交");
                    return true;
                }
            })
        })
    </script>
Last modification:July 9th, 2019 at 06:34 am
If you think my article is useful to you, please feel free to appreciate

One comment

  1. pddh

    电商专用快递网站,空包网,单号网www.danhw.com

Leave a Comment