Create Radio buttons

Description

The following code shows how to create Radio buttons.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.7.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css">
<script type='text/javascript'
  src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){<!--  w w  w . j  a  v  a  2s.c o  m-->
$("input[name=langs]:radio").bind( "change", function(event, ui) {
    console.log('Lang: '+$(this).val());
});
});//]]>  
</script>
</head>
<body>
  <div data-role="page">
    <fieldset data-role="controlgroup">
      <legend>Choose a language:</legend>
      <input type="radio" name="langs" id="english-lang" value="en" /> 
      <label for="english-lang">English</label> 
      <input type="radio" name="langs" id="korean-lang" value="ko" /> 
      <label for="korean-lang">Korean</label>
    </fieldset>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme