jquery对radio的操作

1 <label>性  别</label>

2 <input type="radio" value="1" name="sex"/><label>男</label>

3 <input type="radio" value="2" name="sex"/><label>女</label>   

js:

1
$(":radio[name='sex'][value='" + sex + "']").prop("checked", "checked");

 

判断radio是否选中

if($(this).is(":checked")){  
//do something
}

 

取消radio的选中状态

  $(":radio[name='entrustDateType']").each(function(index,obj){
          obj.checked = false;
   })

 监听radio的选中动作

$(function () {
            $("input[name=ownersSituation]").on('click',function () {
                       var item= $(this).val();
                       if(item!=0){
                           $("#gyqhid").show();
                       }else{
                           $("#gyqhid").hide();
                       }
                 })
})

 

posted @ 2020-06-16 20:51  十月围城小童鞋  阅读(201)  评论(0编辑  收藏  举报