<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.help {display: none}
#menu {display: none}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$("form").submit(function() {
if ($("input#username").val() == "")
$("span.help").show();
return false;
});
</script>
</head>
<body>
<form method="post">
<label for="username">請輸入大名</label>
<input type="text" id="username" name="username" />
<span class="help">這個欄位必填喔</span>
<input type="submit"/>
</form>
</body>
</html>
網路上找的資料驗證範例
但沒有預期的效果
請板上高手指點一下
另外請教瀏覽器要怎麼debug呢