Jquery-mobile-checkbox-icon-position

提供:Dev Guides
移動先:案内検索

jQuery Mobile-チェックボックスアイコンの位置

説明

チェックボックスアイコンボタンの位置は、_fieldset_の _data-iconpos = "right" _ 属性を使用して右側に設定できます。 デフォルトでは、チェックボックスアイコンは左側に設定されています。

次の例は、jQuery Mobileでの_icon position checkbox_の使用を示しています。

<!DOCTYPE html>
<html>
   <head>
      <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>Icon Position Example</h2>
      <form>
         <fieldset data-role = "controlgroup" data-iconpos = "right">
            <input type = "checkbox" id = "checkbox 1"/>
            <label for = "checkbox 1">Checkbox 1</label>

            <input type = "checkbox" id = "checkbox 2"/>
            <label for = "checkbox 2">Checkbox 2</label>

            <input type = "checkbox" id = "checkbox 3"/>
            <label for = "checkbox 3">Checkbox 3</label>
         </fieldset>
      </form>
   </body>
</html>

出力

上記のコードがどのように機能するかを確認するために、次の手順を実行してみましょう-

  • 上記のHTMLコードを icon_positionl ファイルとしてサーバーのルートフォルダーに保存します。
  • このHTMLファイルをhttp://localhost/icon_positionlとして開くと、次の出力が表示されます。