jQuery Mobile: Basic Radio Buttons

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

Radio inputs are used to provide a list of options where only a single option can be selected.

<!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' id='pageone'>
    <div data-role='header'><h1>Basic Radio Button</h1></div>
    <p>Basic Radio Button</p>
        <label><input type='radio' name='radio_choice' id='radio_choice_id1'>One</label>
        <label for='radio_choice_id2'>Two</label>
        <input type='radio' name='radio_choice' id='radio_choice_id2'>

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

I have used the <label> tag so if you click on the label (one, two), it is the same as clicking on the button, toggling the selection.

Series Navigation<< jQuery Mobile: All Checkboxes
jQuery Mobile: Horizontal Radio Button Group >>

Leave a comment

Leave a Reply