多个单选框,用jquery判断被选中的单选框的值

html:

1 <input type="radio" name="radio" value="1" />1
2  
3 <input type="radio" name="radio" value="2" />2
4  
5 <input type="radio" name="radio" value="3" />3
6  
7 <input type="radio" name="radio" value="4" />4

Jquery:

1 var a = $("input[name='radio']:checked").val();
2 alert("选中的radio的值是:" + a);

 

posted @ 2018-05-31 17:09  哟风  Views(1000)  Comments(0)    收藏  举报