jQuery Mobile - 複選框增強



說明

使用 data-enhanced = "true" 到輸入欄位中增強複選框。

示例

以下示例演示了在 jQuery Mobile 中使用增強複選框

<!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 程式碼另存為 enhanced.html 檔案。

  • 將此 HTML 檔案作為 https:///enhanced.html 開啟,將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.