Posted in Javascript onNovember 08, 2013
html:
<tr> <td align="right"> </td> <td align="left" colspan="3"> <input type="checkbox" class="checkboxListItem" name="checkItem" value="3" id="slsa_approval" />批准 <input type="checkbox" class="checkboxListItem" name="checkItem" value="4" id="slsa_noApproval" />不批准 </td> </tr>
jquery :
$(function () { $(".checkboxListItem").change( //教师 function () { var $checkValue = $("input[name='checkItem']:checked").val(); if ($checkValue == 3) { $("#slsa_approval").attr("checked", true); $("#slsa_noApproval").attr("checked", false); } else { $("#slsa_approval").attr("checked", false); $("#slsa_noApproval").attr("checked", true); } }); });
通过值的判断:
var checkCheckbox = $("#slsa_approval").attr("checked"); if (checkCheckbox == true) { auditState = "3"; } else { auditState = "4"; }
jqueyr判断checkbox组的选中(示例代码)
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@