我制作了一个注册表单,如果您保留姓名或姓氏输入,它会在输入旁边显示一个错误闪烁并走开。按钮类型是提交我正在写下代码
function SignUp() {
var firstname = $("#firstname").val();
var lastname = $("#lastname").text();
var date = $("#dd option:selected").text();
var month = $("#mm option:selected").text();
var yy = $("#yy option:selected").text();
var sex = $("input:radio[name=sex]:checked").val();
if ($.trim($("#firstname").val()) == "") {
document.getElementById("firstnameerror").innerHTML = "Please write firstname";
if ($.trim($("#lastname").val()) == "") {
document.getElementById("lastnameerror").innerHTML = "Please write lastname";
if (!$("input[name='sex']:checked").val()){
document.getElementById("gendererror").innerHTML = "Please select your gender";
}
}
}
}