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);
}
});
});
});