代码语言:javascript复制
<form id="form1">
<input type="text" value="1" name="Total" />
</form>
代码语言:javascript复制//判断序列化表单是否包含空值
var data = $("#form").serialize();
var array = data.split("&");
for (var i = 0; i < array.length; i ) {
var kwarr = array[i].split("=");
for (var j = 0; j < kwarr.length; j ) {
if (kwarr[j] == null || kwarr[j] == '') {
alert("请把必填信息填上")
return false;
}
}
}