jquery获取radio值(单选组radio)

前端之家收集整理的这篇文章主要介绍了jquery获取radio值(单选组radio)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_502_0@单选组radio: $("input[@type=radio][@checked]").val();


@H_502_0@单选组radio: $("input[@type=radio]").attr("checked",'2');//设置value=2的项目为当前选中项


@H_502_0@获取一组radio被选中项的值


@H_5020@var item = $('input[@name=items][@checked]').val();


@H
502_0@radio单选组的第二个元素为当前选中值


@H_5020@$('input[@name=items]').get(1).checked = true


@H
502_0@单选组 radio: $("input[@type=radio]").attr("checked",'2');//设置value=2的项目为当前选中项


@H_5020@jquery老的版本


@H
502_0@var_name = $("input[@name='radioname']:checked").val();


@H
5020@jquery 1.3以后的版本


@H
502_0@var_name = $("input[name='radioname']:checked").val();


@H
502_0@看个获取radio值的jquery实例


<div class="jb51code">
<pre class="brush:js;">
function getra(){

var_name = $("input[name='isspecialcnt']:checked").val();
//alert(var_name);
if(var_name=='1'){
$("#isspecialcntyes").show();
$("#isspecialcntno").hide();
}
if(var_name=='0'){
$("#isspecialcntyes").hide();
(www.jb51.cc) $("#isspecialcntno").show();
}
}

<form name="form1" method="post" action="">
@H_502_0@







猜你在找的jQuery相关文章