radio checked不起作用的原因

时间:2022-07-02 00:34:16
 <table  id="approveTable">
<tr>
<td>
<input type="radio" name="action" value="1" checked="checked" onclick='$("#selectRow").css("visibility","visible");'/>成功
</td>
<td>
<input type="radio" name="action" value="0" onclick='$("#selectRow").css("visibility","hidden");'/>失败
</td>
</tr>
</table>

这种方式checked是起作用,但如果不把控件包在td中就不起作用了,如下:

 <table  id="approveTable">
<tr> <input type="radio" name="action" value="1" checked="checked" onclick='$("#selectRow").css("visibility","visible");'/>成功 <input type="radio" name="action" value="0" onclick='$("#selectRow").css("visibility","hidden");'/>失败 </tr>
</table>