jQuery Mobile: Vertically Grouped Radio Buttons

This entry is part 24 of 73 in the series jQuery Mobile

To integrate multiple radio buttons into a vertically grouped button set, we can useĀ data-role=’controlgroup’>.

The code is as below.

<!DOCTYPE html>
    <link href='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js'></script>
<div data-role='page'>
    <div data-role='header'><h1>Vertically Grouped Radio Buttons</h1></div>
    <p>Vertically Grouped Radio Buttons</p>
        <fieldset data-role='controlgroup'>
            <input type='radio' name='radio_choice' id='radio_choice_id1' value='on' checked='checked'>
            <label for='radio_choice_id1'>One</label>
            <input type='radio' name='radio_choice' id='radio_choice_id2' value='off'>
            <label for='radio_choice_id2'>Two</label>
            <input type='radio' name='radio_choice' id='radio_choice_id3' value='other'>
            <label for='radio_choice_id3'>Three</label>

    <div data-role='footer' data-position='fixed'>
Try The Code

In the above radio button settings, the first button is set to checked.

Series Navigation<< jQuery Mobile: Mini Size Radio Buttons
jQuery Mobile: Basic Collapsible Header >>