jQuery Mobile - Seleção de grupos de controle

Descrição

Crie a lista suspensa no grupo de controle usando o data-role = "controlgroup" atributo.

Exemplo

O exemplo a seguir descreve o uso de seleções de grupo de controle no jQuery Mobile Framework.

<!DOCTYPE html>
<html>
   <head>
      <title>Controlgroup Selects</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 Select</h2>
      <form>
         <fieldset data-role = "controlgroup">
            <select>
               <option value = "#">India</option>
               <option value = "#">Australia</option>
               <option value = "#">New Zealand</option>
            </select>
         </fieldset>
      </form>
      
      <h2>Minisized Vertical Select</h2>
      <form>
         <fieldset data-role = "controlgroup" data-mini = "true">
            <select>
               <option value = "#">India</option>
               <option value = "#">Australia</option>
               <option value = "#">New Zealand</option>
            </select>
         </fieldset>
      </form>
      
      <h2>Horizontal Select</h2>
      <form>
         <fieldset data-role = "controlgroup" data-type = "horizontal">
            <select>
               <option value = "#">India</option>
               <option value = "#">Australia</option>
               <option value = "#">New Zealand</option>
            </select>
         </fieldset>
      </form>
      
      <h2>Minisized Horizontal Select</h2>
      <form>
         <fieldset data-role = "controlgroup" data-type = "horizontal" data-mini = "true">
            <select>
               <option value = "#">India</option>
               <option value = "#">Australia</option>
               <option value = "#">New Zealand</option>
            </select>
         </fieldset>
      </form>
   </body>
</html>

Resultado

Vamos realizar as seguintes etapas para ver como o código acima funciona -

  • Salve o código html acima como jqm_controlgroup_selects.html arquivo na pasta raiz do servidor.

  • Abra este arquivo HTML como http: //localhost/jqm_controlgroup_selects.html e a seguinte saída será exibida.