-1

I've got this jQuery for processing many radio buttons in a form, but I want to know how I can write it in Vanilla Javascript.

const checked_radios = $('input[type="radio"]:checked');

Thank you.

I know there are other posts explaining how jQuery works behind the scenes, but the specific cases might be useful not only to me but to others.

Gaston
  • 41
  • 5
  • Have a look at this website for future iterations: http://youmightnotneedjquery.com/ – Adriano Dec 22 '18 at 02:26
  • Possible duplicate of [How can I learn how jQuery selectors work behind the scenes?](https://stackoverflow.com/questions/11631711/how-can-i-learn-how-jquery-selectors-work-behind-the-scenes) – hgb123 Dec 22 '18 at 02:40

1 Answers1

2

You can use querySelectorAll:

const checked_radios = document.querySelectorAll('input[type="radio"]:checked');
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231