$(function () {
//To send data from input text
$('#add').click(function () {
var name = $('#name').val();
var gender = $('#gender').val();
var age = $('#age').val();
var address = $('#address').val();
var illness = $('#illness').val();
var selectunit = $('#selectunit').val();
if (typeof name !== null) {
my codes here...
} else {
alert('Some fields are missing!');
}
return false;
});
});
我想在执行代码之前捕获我的变量(姓名、年龄、地址、疾病)不为空,请帮助谢谢