How to get value of selected radio button?

前端 未结 28 2954
温柔的废话
温柔的废话 2020-11-22 03:51

I want to get the selected value from a group of radio buttons.

Here\'s my HTML:

28条回答
  •  面向向阳花
    2020-11-22 04:32

    This works in IE9 and above and all other browsers.

    document.querySelector('input[name="rate"]:checked').value;
    

提交回复
热议问题