radio标签 onchange事件

1、radio标签
  <input type="radio" id="ZX2_BLX_AB005" name="zx_zx_blx" value="AB005" />
<label for="ZX2_BLX_AB005">主项</label>
<input type="radio" id="ZX2_BLX_AB006" name="zx_zx_blx" value="AB006" checked="checked" />
<label for="ZX2_BLX_AB006">子项</label>
<input type="radio" id="ZX2_BLX_AB007" name="zx_zx_blx" value="AB007" />
<label for="ZX2_BLX_AB007">办理项</label>
2、onchange 实现
<script type="text/javascript">
$(document).ready(function(){
$('input[type=radio][name=zx_zx_blx]').change(function() {
if (this.value == 'AB005') {
console.log('
AB005');
} else if (this.value == 'AB006') {
      console.log('AB006');
} else if (this.value == 'AB007') {
      console.log('AB005');
}
});
});
</script>
posted @ 2020-03-26 17:47  壹玖玖肆  阅读(2387)  评论(0编辑  收藏  举报