
- jQuery Mobile Tutorial
- jQuery Mobile - Home
- jQuery Mobile - Overview
- jQuery Mobile - Setup
- jQuery Mobile - Pages
- jQuery Mobile - Icons
- jQuery Mobile - Transitions
- jQuery Mobile - Layouts
- jQuery Mobile - Widgets
- jQuery Mobile - Events
- jQuery Mobile - Forms
- jQuery Mobile - Themes
- jQuery Mobile - CSS Classes
- jQuery Mobile - Data Attributes
- jQuery Mobile Useful Resources
- jQuery Mobile - Interview Questions
- jQuery Mobile - Quick Guide
- jQuery Mobile - Useful Resources
- jQuery Mobile - Discussion
jQuery Mobile - Controlgroup Checkbox
Description
You can create the checkbox in the controlgroup using the type = "checkbox" attribute.
Example
Following example describes the use of controlgroup checkbox in the jQuery Mobile Framework.
<!DOCTYPE html> <html> <head> <title>Controlgroup Checkbox</title> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <h2>Vertical Checkbox</h2> <form> <fieldset data-role = "controlgroup"> <input type = "checkbox" name = "checkbox1" id = "checkbox11" /> <label for = "checkbox11">India</label> <input type = "checkbox" name = "checkbox1" id = "checkbox12" /> <label for = "checkbox12">Australia</label> <input type = "checkbox" name = "checkbox1" id = "checkbox13" /> <label for = "checkbox13">New Zealand</label> </fieldset> </form> <h2>Minisized Vertical Checkbox</h2> <form> <fieldset data-role = "controlgroup" data-mini = "true"> <input type = "checkbox" name = "checkbox1" id = "checkbox14" /> <label for = "checkbox14">India</label> <input type = "checkbox" name = "checkbox1" id = "checkbox15" /> <label for = "checkbox15">Australia</label> <input type = "checkbox" name = "checkbox1" id = "checkbox16" /> <label for = "checkbox16">New Zealand</label> </fieldset> </form> <h2>Horizontal Checkbox</h2> <form> <fieldset data-role = "controlgroup" data-type = "horizontal"> <input type = "checkbox" name = "checkbox1" id = "checkbox17" /> <label for = "checkbox17">India</label> <input type = "checkbox" name = "checkbox1" id = "checkbox18" /> <label for = "checkbox18">Australia</label> <input type = "checkbox" name = "checkbox1" id = "checkbox19" /> <label for = "checkbox19">New Zealand</label> </fieldset> </form> <h2>Minisized Horizontal Checkbox</h2> <form> <fieldset data-role = "controlgroup" data-type = "horizontal" data-mini = "true"> <input type = "checkbox" name = "radio1" id = "checkbox20" /> <label for = "checkbox20">India</label> <input type = "checkbox" name = "radio1" id = "checkbox21" /> <label for = "checkbox21">Australia</label> <input type = "checkbox" name = "radio1" id = "checkbox22" /> <label for = "checkbox22">New Zealand</label> </fieldset> </form> </body> </html>
Output
Let's carry out the following steps to see how the above code works −
Save the above html code as jqm_controlgroup_checkbox.html file in your server root folder.
Open this HTML file as http://localhost/jqm_controlgroup_checkbox.html and the following output will be displayed.
jquery_mobile_widgets.htm
Advertisements