2
我有一個帶單選按鈕的基本表。即使在點擊「td」時檢查收音機的「td」中,我也有一個onclick。單擊「td」時,錯誤消息不會隱藏。它只在實際按鈕被點擊時隱藏。這是我的代碼。有任何想法嗎?我有本地存儲的jquery文件。jquery驗證插件隱藏錯誤消息
<html>
<head>
<script src="jquery-latest.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#myform").validate({
errorPlacement: function(error, element) {
error.appendTo(element.parent("td").prev("td"));
},
debug:true
})
});
</script>
</head>
<body>
<form id="myform" action="/login" method="post">
<table border="1">
<tr>
<td width="30%">Attribute 1<br /></td>
<td width="10%" onclick="$(this).find('input:radio').attr('checked','checked');" /><INPUT type="radio" id="22121GRID" name="SPGRID_1" value="5" class="required" /></td>
<td width="10%" onclick="$(this).find('input:radio').attr('checked','checked');" /><INPUT type="radio" id="22121GRID" name="SPGRID_1" value="4" class="required" /></td>
<td width="10%" onclick="$(this).find('input:radio').attr('checked','checked');" /><INPUT type="radio" id="22121GRID" name="SPGRID_1" value="3" class="required" /></td>
<td width="10%" onclick="$(this).find('input:radio').attr('checked','checked');" /><INPUT type="radio" id="22121GRID" name="SPGRID_1" value="2" class="required" /></td>
<td width="10%" onclick="$(this).find('input:radio').attr('checked','checked');" /><INPUT type="radio" id="22121GRID" name="SPGRID_1" value="1" class="required" /></td>
</tr>
<tr><td><input type="submit" value="Submit" /></td></tr>
</table>
</form>
</body>
</html>