Home 页面字段空值校验
Post
Cancel

页面字段空值校验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function checkIsNull() {
    var flag = false;
    var test1 = $('input:radio[name="test1"]:checked').val();
    var test2 = $("#test2").val()

    if (test1) {
        flag = true;
    } else {
        alert("输入框1不能为空!");
        flag = false;
    }
    if (flag && test2) {
        flag = true;
    } else if (flag) {
        alert("输入框2不能为空!");
        flag = false;
    }
    return flag;
}
This post is licensed under CC BY 4.0 by the author.