Html代码是
<label><input type="radio" name="proofing" value="1">打样</label> <label><input type="radio" name="proofing" value="0" checked="checked">不打样</label>
jqury代码是
$("input:radio[name='proofing']").change(function (){ //拨通 var value = $("input[name='proofing']:checked").val(); alert(value); if (value == 0) { $(".proofing-hide").show(); } else { $(".proofing-hide").hide(); } });
这里注意
var value = $("input[name='proofing']:checked").val();
我用
<pre name="code" class="javascript"><pre name="code" class="javascript">var value = <span style="font-family: Arial, Helvetica, sans-serif;">$("input:radio[name='proofing']")</span><span style="font-family: Arial, Helvetica, sans-serif;">.val(); </span>获取到的始终是1