Jquery plugins jquery验证插件隐藏错误消息

Jquery plugins jquery验证插件隐藏错误消息,jquery-plugins,Jquery Plugins,我有一张带单选按钮的基本桌子。我甚至在“td”中有一个onclick,当点击“td”时,它会检查收音机。单击“td”时,错误消息不会隐藏。它仅在单击实际按钮时隐藏。这是我的密码。有什么想法吗?我将jquery文件存储在本地 <html> <head> <script src="jquery-latest.js"></script> <script type="text/javascript" src="

我有一张带单选按钮的基本桌子。我甚至在“td”中有一个onclick,当点击“td”时,它会检查收音机。单击“td”时,错误消息不会隐藏。它仅在单击实际按钮时隐藏。这是我的密码。有什么想法吗?我将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>

$(文档).ready(函数(){
$(“#myform”)。验证({
errorPlacement:函数(错误,元素){
错误.appendTo(element.parent(“td”).prev(“td”);
},
调试:正确
})
});
属性1

既然您通过javascript更改了checked-through,请调用validator的
.valid()
方法

您可以使用以下命令

<td width="10%" onclick="$(this).find('input:radio').attr('checked','checked').valid();" />            <INPUT  type="radio" id="22121GRID" name="SPGRID_1" value="5" class="required"  /> </td>
$('td').click(function(){
$(this).find('radio').attr('checked','checked').valid();
});