<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
© The copyright belongs to the author
Comment here is closed