我正在验证表单,我在弹出窗口中显示一条消息,但<br>
没有收到错误消息。为什么会如此。我的代码如下:
function closeBox() {
var errorMsg = "";
var ferrorMsg = "first name is needed" + "<br>";
var aerrorMsg = "Please type address" + "<br>";
var eerrorMsg = "Please type a valid email Address"
if($("#name").val() == "") {
errorMsg += ferrorMsg;
}
if($("#address").val() == "") {
errorMsg += aerrorMsg;
}
if($("#email").val() == "") {
errorMsg += eerrorMsg;
}
$(".errorContainer").text(errorMsg);
$(".popupBox").remove();
}
$("body").append("<div class='overlay'><div class='errorContainer'></div><div><a href='javascript:void(0);' onclick='closeBox()'>X</a><div></div>");