0
大家好我有一个具有4个领域 我能得到它来检查任何字段为空,并更改没有问题的背景颜色,但我得到的问题是,如果所有的字段是形式不是空的它不是继续的代码表单元素验证JQuery的
$(document).ready(function(){
$("#submitpw").click(function(){
var un = $("#FirstName").val();
var pw = $("#LastName").val();
var sid = $("#StudentID").val();
var ss = $("#LastFour").val();
var unl = un.substring(0,un.length - un.length + 1);
var pwl = pw.substring(0,pw.length - pw.length +4)
var emptyTextBoxes = $('.information').filter(function() { return this.value == ""; });
emptyTextBoxes.each(function() {
if ($('.information:empty'))
{
$(this).css("background-color", "red");
alert("Please Enter Information in the Red Fields");
}
else
{
("This is the part that never triggers!!!")
alert("it worked");
$("#campusun").html(unl+pwl+sid+ss);
$("#campuspw").html(sid+ss);
$("#emailun").html(unl+pwl+sid+"@live.tcicollege.edu");
$("#emailpw").html(sid+ss);
}
});
});
});