How to get the selected value of the radio button list in jquery?

左心房为你撑大大i 提交于 2019-11-27 21:50:37
Paolo Bergantino

If you have HTML that looks like this:

<input type='radio' name='choices' value='1'>
<input type='radio' name='choices' value='2'>
<input type='radio' name='choices' value='3'>
<input type='radio' name='choices' value='4'>
<input type='radio' name='choices' value='5'>

You would get the selected radio value with this:

$("input:radio[name='choices']:checked").val();
Ashish Babu

It will get the selected value of the radiobutton at button click.
ex for list

$("#btn").click(function() {
   $('input[type="radio"]:checked').val();
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!