Jquery-mobile-checkbox-enhanced

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

jQuery Mobile-チェックボックスの強化

説明

チェックボックスは、入力フィールドに _data-enhanced = "true" _ を使用して拡張されています。

次の例は、jQuery Mobileでの_enhanced 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>Enhanced Checkbox Example</h2>
      <form>
         <div class = "ui-checkbox">
            <label for = "checkbox1" class = "ui-btn ui-corner-all">Checkbox</label>
            <input type = "checkbox" id = "checkbox1" data-enhanced = "true"/>
         </div>
      </form>
   </body>
</html>

出力

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

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