[問題] jquery提問
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="" rel="nofollow">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="" rel="nofollow">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呢
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.57.123.247
推
12/18 22:48, , 1F
12/18 22:48, 1F
推
12/18 22:50, , 2F
12/18 22:50, 2F
→
12/18 22:52, , 3F
12/18 22:52, 3F
→
12/19 00:49, , 4F
12/19 00:49, 4F
→
12/19 00:55, , 5F
12/19 00:55, 5F
→
12/19 00:56, , 6F
12/19 00:56, 6F
→
12/19 00:57, , 7F
12/19 00:57, 7F
→
12/19 00:59, , 8F
12/19 00:59, 8F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章
7
20