Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 10
    Just going to add this because it might help someone. If the name of the radio has brackets like radioName[0] (sometimes used in Wordpress), you will want to use quotes around the name like input[name='radioName[0]']:checked
    – ZeroNine
    Commented Dec 21, 2020 at 5:07
  • 3
    Just noting, in the onChange method example, you can also use this.value instead of $('input[name=radioName]:checked', '#myForm').val() :) Commented Feb 25, 2021 at 19:39
  • For a non-jquery version, see here: jsfiddle.net/2y76vp1e Commented Mar 28, 2021 at 5:54
  • @ ZeroNine, that's also the case in Symfony framework that I use.
    – Ali
    Commented Jun 19, 2021 at 7:41
  • 2
    @AngelUmeh that's right!
    – Peter J
    Commented Sep 19, 2022 at 21:40