jquery-radio lets you painlessly get and set the current value of a group of radio buttons, filling a gap in jQuery's $.val. It is not a replacement for radio buttons. It just makes working with them more pleasant.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
logos
LICENSE.md
README.md
jquery.radio.js
radio.jquery.json

README.md

jquery-radio

jquery-radio makes it easy to get or set the current value of a group of radio buttons, filling a gap in jQuery's $.val().

How to Use

Select all of the buttons in the group and call .radio():

// Check the box with value="5"
$('input.my-radio-group').radio(5);
// Get the value of the checked box
var value = $('input.my-radio-group').radio();

This example assumes you have several radio buttons that all have the .my-radio-group class.

Requirements

You need jQuery, of course. jquery-radio is actively supported with jQuery 1.9 and 2.0 but should work fine with older versions.

Changelog

0.1.3: cross browser support for IE and Firefox, which don't like the use of jQuery's attr to manipulate checkboxes very much. What does work is a combination of setAttribute and the checked property on the DOM element itself.

About P'unk Avenue and Apostrophe

jquery-radio was created at P'unk Avenue for use in Apostrophe, an open-source content management system built on node.js. If you like jquery-radio you should definitely check out apostrophenow.org. Also be sure to visit us on github.

Support

Feel free to open issues on github.