jquery判断表单内容是否为空

表单里的input必须有name值

    //判断表单数据是否为空
      var t = $('form').serializeArray();
        $.each(t,function(i,item){
            if(item['value'] == '') {
                console.log('信息不可为空') 
                showMsg('信息不可为空')
                flag = 1;
                return false
            } else {
            flag = 0;
        }
        })

猜你喜欢

转载自blog.csdn.net/helloworld_dream/article/details/80435537