How to design form controls for mobiles using jQuery Mobile Square-UI Theme plugin ?

In this article, we will learn how to design the form controls for mobile-oriented applications using the jQuery Mobile Square-UI Theme plugin.
Prerequisite: Download the pre-compiled required library files from the given link and save it in your working folder for the following implementation.
Example 1:
HTML
<!DOCTYPE html> <html> Â Â <head> Â Â Â Â <meta charset="utf-8" /> Â Â Â Â <meta name="viewport" content= "width=device-width, initial-scale=1"> Â Â Â Â Â Â <link rel="stylesheet" type="text/css"Â Â Â Â Â href="css/jquery.mobile.squareui.css" /> Â Â Â Â Â Â <script src="js/jquery.js"></script> Â Â Â Â <script src="js/jquery.mobile-1.4.0.min.js"> Â Â Â Â </script> </head> Â Â <body> Â Â Â Â <h3>Example of buttons</h3> Â Â Â Â <div data-role="content" role="main"> Â Â Â Â Â Â Â Â <fieldset class="ui-grid-a"> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-a"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-settings"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="a"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 1 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-b"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-new"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="b"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 2 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-a"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-man"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="c"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 3 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-b"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-mail"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="d"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 4 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-a"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-lock"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="e"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 5 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-b"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-menu"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="f"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 6 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â Â Â Â Â <div class="ui-block-a"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <button data-icon="flat-heart"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data-theme="g"> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Button 7 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </button> Â Â Â Â Â Â Â Â Â Â Â Â </div> Â Â Â Â Â Â Â Â </fieldset> Â Â Â Â </div> </body> Â Â </html> |
Output:Â
Â
Example 2:
HTML
<!DOCTYPE html> <html>   <head>     <meta charset="utf-8" />     <meta name="viewport" content=         "width=device-width,         initial-scale=1">       <link rel="stylesheet" type="text/css"         href="css/jquery.mobile.squareui.css" />       <script src="js/jquery.js"></script>     <script src=         "js/jquery.mobile-1.4.0.min.js">     </script>       <style>         h3 {             padding: 15px;             margin: 0 auto;         }     </style> </head>   <body>     <h3>Example of Checkboxes</h3>       <b>SELECT SUBJECTS</b>     <br>     <div data-role="fieldcontain">         <fieldset data-role="controlgroup">             <input type="checkbox"                 name="checkbox-a" data-theme="c"                 id="maths" checked="checked" />                               <label for="maths">Maths</label>             <input type="checkbox"                 name="checkbox-a" data-theme="c"                 id="science" checked="checked" />               <label for="science">Science</label>             <input type="checkbox"                 name="checkbox-a" data-theme="c"                 id="english" checked="checked" />             <label for="english">English</label>         </fieldset>     </div> </body>   </html> |
Output:
Example 3:
HTML
<!DOCTYPE html> <html>   <head>     <meta charset="utf-8" />     <meta name="viewport" content=         "width=device-width,         initial-scale=1">       <link rel="stylesheet" type="text/css"         href="css/jquery.mobile.squareui.css" />       <script src="js/jquery.js"></script>       <script src=         "js/jquery.mobile-1.4.0.min.js">     </script>       <style>         h3 {             padding: 15px;             margin: 0 auto;         }     </style> </head>   <body>     <h2>Example of Collapsible set</h2>       <div data-role="collapsible-set"         data-theme="b" data-content-theme="b">           <div data-role="collapsible"             data-collapsed-icon="flat-time"             data-expanded-icon="flat-cross"            data-collapsed="false">             <h3>First Section</h3>               <p>content for first section </p>         </div>           <div data-role="collapsible"             data-collapsed-icon="flat-calendar"             data-expanded-icon="flat-cross">             <h3>Second Section</h3>               <p>content for second section </p>         </div>           <div data-role="collapsible"             data-collapsed-icon="flat-settings"             data-expanded-icon="flat-cross">             <h3>Third Section </h3>               <p>content for third section</p>         </div>     </div> </body>   </html> |
Output:Â
Â
Example 4:
HTML
<!DOCTYPE html> <html>   <head>     <meta charset="utf-8" />       <meta name="viewport" content=         "width=device-width,         initial-scale=1">       <link rel="stylesheet" type="text/css"        href="css/jquery.mobile.squareui.css" />       <script src="js/jquery.js"></script>       <script src=         "js/jquery.mobile-1.4.0.min.js">     </script>       <style>         h3 {             padding: 15px;             margin: 0 auto;         }     </style> </head>   <body>     <h2>Example of Link</h2>     <div data-role="fieldcontain" id="divID">         <div data-role="controlgroup"             data-type="horizontal">             <a href="#" data-icon="flat-mail"                 data-theme="a" data-iconpos="notext"                data-role="button">                 Yes             </a>             <a href="#" data-icon="flat-camera"                 data-theme="a" data-iconpos="notext"                data-role="button">                 Yes             </a>             <a href="#" data-icon="flat-heart"                 data-theme="a" data-iconpos="notext"                data-role="button">                 Yes             </a>             <a href="#" data-icon="flat-eye"                 data-theme="a" data-iconpos="notext"                data-role="button">                 Yes             </a>         </div>     </div> </body>   </html> |
Output:Â
Â
Example 5:
HTML
<!DOCTYPE html> <html>   <head>     <meta charset="utf-8" />     <meta name="viewport" content=         "width=device-width,         initial-scale=1">       <link rel="stylesheet" type="text/css"        href="css/jquery.mobile.squareui.css" />       <script src="js/jquery.js"></script>       <script src=         "js/jquery.mobile-1.4.0.min.js">     </script>       <style>         h3 {             padding: 15px;             margin: 0 auto;         }     </style> </head>   <body>     <h3>Example of List</h3>     <div data-role="content" role="main">         <ul data-role="listview" data-inset="true">             <li data-role="list-divider"                 data-theme="a">                 You can give a List Header             </li>               <li>                 This is list item             </li>               <li>                 <a href="#">                     This is list item with link                 </a>             </li>         </ul>     </div> </body>   </html> |
Output:Â
Â
Example 6:
HTML
<!DOCTYPE html> <html>   <head>     <meta charset="utf-8" />     <meta name="viewport" content=         "width=device-width,         initial-scale=1">       <link rel="stylesheet" type="text/css"         href="css/jquery.mobile.squareui.css" />       <script src="js/jquery.js"></script>       <script src=         "js/jquery.mobile-1.4.0.min.js">     </script>       <style>         h3 {             padding: 15px;             margin: 0 auto;         }     </style> </head>   <body>     <h3>Example of Radio Buttons</h3>       SELECT GENDER <br>     <div data-role="fieldcontain">         <fieldset data-role="controlgroup">             <input type="radio" name="radio-choice-a"                data-theme="c" id="radio1"                 value="choice-1" checked="checked" />             <label for="radio1">Male</label>               <input type="radio" name="radio-choice-a"                data-theme="c" id="radio2"                value="choice-2" />             <label for="radio2">Female</label>         </fieldset>     </div> </body>   </html> |
Output:Â
Â
Example 7:
HTML
<!DOCTYPE html> <html>   <head>     <meta charset="utf-8" />       <meta name="viewport" content=         "width=device-width,         initial-scale=1">       <link rel="stylesheet" type="text/css"        href="css/jquery.mobile.squareui.css" />       <script src="js/jquery.js"></script>       <script src=         "js/jquery.mobile-1.4.0.min.js">     </script>       <style>         h3 {             padding: 15px;             margin: 0 auto;         }     </style> </head>   <body>     <h2>Example of Select dropdown</h2>       <div id="divID">         <select name="flipID" id="flipID"            data-role="slider">             <option value="on" selected>On</option>             <option value="off">Off</option>         </select>     </div> </body>   </html> |
Output:
Example 8:
HTML
<!DOCTYPE html> <html> Â Â <head> Â Â Â Â <meta charset="utf-8" /> Â Â Â Â <meta name="viewport"Â Â Â Â Â content="width=device-width, initial-scale=1"> Â Â Â Â <link rel="stylesheet" type="text/css"Â Â Â Â Â Â Â Â href="css/jquery.mobile.squareui.css" /> Â Â Â Â <script src="js/jquery.js"></script> Â Â Â Â <script src= Â Â Â Â Â Â Â Â "js/jquery.mobile-1.4.0.min.js"> Â Â Â Â </script> Â Â Â Â <style> Â Â Â Â Â Â Â Â h3{ Â Â Â Â Â Â Â Â Â padding:15px; Â Â Â Â Â Â Â Â Â margin: 0 auto; Â Â Â Â Â Â Â Â } Â Â Â Â Â Â </style> </head> Â Â <body> Â Â Â Â <h2>Example of Select choice</h2>Â Â Â Â Â Â Â <div data-role="fieldcontain" id="divID"> Â Â Â Â Â Â Â Â <label for="country">Country:</label>Â Â Â Â Â Â Â Â Â <select name="select-choice" id="select-choice-a"Â Â Â Â Â Â Â Â Â Â Â Â Â data-native-menu="false" data-theme="a"> Â Â Â Â Â Â Â Â Â Â Â Â <option value="india">India</option> Â Â Â Â Â Â Â Â Â Â Â Â <option value="australia">Australia</option> Â Â Â Â Â Â Â Â Â Â Â Â <option value="china">China</option> Â Â Â Â Â Â Â Â Â Â Â Â <option value="japan">Japan</option> Â Â Â Â Â Â Â Â </select> Â Â Â Â </div> </body> Â Â </html> |
Output:Â
Â
Example 9:
HTML
<!DOCTYPE html> <html> Â Â <head> Â Â Â Â <meta charset="utf-8" /> Â Â Â Â <meta name="viewport"Â Â Â Â Â content="width=device-width, initial-scale=1"> Â Â Â Â <link rel="stylesheet" type="text/css"Â Â Â Â Â Â Â Â href="css/jquery.mobile.squareui.css" /> Â Â Â Â <script src="js/jquery.js"></script> Â Â Â Â <script src= Â Â Â Â Â Â Â Â "js/jquery.mobile-1.4.0.min.js"> Â Â Â Â </script> Â Â Â Â <style> Â Â Â Â Â Â Â Â h3{ Â Â Â Â Â Â Â Â Â padding:15px; Â Â Â Â Â Â Â Â Â margin: 0 auto; Â Â Â Â Â Â Â Â } Â Â Â Â Â Â </style> </head> Â Â <body> Â Â Â Â <h2>Example of Slider</h2>Â Â Â Â Â Â Â Â <div data-role="fieldcontain" id="divID"> Â Â Â Â Â Â Â Â <input type="range" name="slider"Â Â Â Â Â Â Â Â Â Â Â Â value="50" min="0"Â Â Â Â Â Â Â Â Â Â Â Â max="100" data-highlight="true" /> Â Â Â Â </div> </body> Â Â </html> |
Output:Â
Â
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!




