我有这样的表格:
<form method="post" action="user_submit.php" id="addUserForm">
<p>
<label for="username">Enter Username:*</label>
<input type="text" name="username" id="username">
</p>
<p>
<label for="firstname">Enter First Name*</label>
<input type="text" name="firstname" id="firstname">
</p>
:
<input type="hidden" name="addUser" value="1" />
<p><input type="button" name="submit" value="submit" id="submit_AddUser" onClick="validate_addUser();" ></p>
这是我使用的简单 js
function validate_addUser(){
if (!$('#username').val())
alert('Please enter Username');
else if (!$('#firstname').val())
alert("Please enter first name");
else if (!$('#lastname').val())
alert("Please enter last name");
else if (!$('#email').val())
alert("Please enter email address");
else
$('#addUserForm').submit();
}
当我提交表单时,这是我得到的错误
e[h] is not a function
[Break On This Error]
...{href:function(a){return a.getAttribute("href")