# \[jQuery\] grouping radio buttons by name

**URL:** <https://forum.kirupa.com/t/jquery-grouping-radio-buttons-by-name/275180>\
**Category:** web dev\
**Created:** [November 10, 2008, 10:38pm UTC](https://forum.kirupa.com/t/jquery-grouping-radio-buttons-by-name/275180 "2008-11-10T22:38:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icy\_Penguin](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@Icy\_Penguin](https://forum.kirupa.com/u/Icy_Penguin)\
**Post date:** [November 10, 2008, 10:38pm UTC](https://forum.kirupa.com/t/jquery-grouping-radio-buttons-by-name/275180/1 "2008-11-10T22:38:39Z")

</div>

I’d like to make a toggle button for each group of \<input type=“radio” /\>s where the name attribute is the same.

So I need a way to select all radio inputs where the name is the same AND there are only two of them.

So, the first two radio inputs would be selected here:

```auto

<input type="radio" name="blubber" value="more, please" />
<input type="radio" name="blubber" value="none" />
<input type="radio" name="living room" value="6" />

```

But none would be selected here:

```auto

<input type="radio" name="blubber" value="more, please" />
<input type="radio" name="blubber" value="just a little bit, please" />
<input type="radio" name="blubber" value="none" />
<input type="radio" name="living room" value="6" />
<input type="radio" name="fireplace" value="santa claus" />

```

Thanks 🙂
