0
一個基本形式的一個例子......這是工作,但錯誤文本「不能爲空」出現了第二表單驗證文本錯誤 - 文本消失
<html>
<head><title>Form</title>
</head>
<body>
<form>
Enter EmailID:
<input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</form>
<span></span>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("input[name=submit]").click(function(){
if(!$("input[name=email]").val())
{
$("<span>Cannot be Blank</span>").appendTo("span");
}
});
});
</script>
</body>
</html>