单选框相关操作

获取单选框选中的值

var subjectType = $('input:radio[name="entity.subjectType"]:checked').val();      if(subjectType == null)

设置value=1的选项为选中状态

$("input[type=radio]").attr("checked",'1');

单选框选中的值清空

$('input:radio[name="entity.subjectType"]:checked').attr("checked",false);

判断单选框是否选中

$("input[type=radio]").each(function(){

  if($(this).is(":checked")){

    alert(“选中”);

  }

});

猜你喜欢

转载自www.cnblogs.com/dreamShines/p/10827245.html