在js中取选中的radio值
<input type="radio" name="address" value="0" />
<input type="radio" name="address" value="1" />
<input type="radio" name="address" value="2" />
js中 : var addressID = $("input[name='address']:checked").val();
把radio的name属性值设置成一样的,就会变为单选。
var radio = document.getElementsByName("DoorCt");
for (i=0; i<radio.length; i++) {
if (radio[i].checked) {
alert(radio[i].value)
}
}
http://blog.csdn.net/magi1201/article/details/44465557
- var radio = document.getElementsByName("DoorCt");
- for (i=0; i<radio.length; i++) {
- if (radio[i].checked) {
- alert(radio[i].value)
- }
- }