jQuery Mobile - 文字輸入時間和顏色



說明

時間輸入型別允許使用者根據 ISO 8601 編碼輸入時間(小時、分鐘、秒、小數秒)。

顏色輸入型別允許使用者從顯示的顏色框中選擇特定的顏色。

示例

以下示例演示如何在 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>
      <form>
         <h2>Time Input Example</h2>
         <label for = "src">Time Input</label>
         <input type = "time" id = "src" data-clear-btn = "false">
         
         <label for = "src1">Clear the Time Field</label>
         <input type = "time" data-clear-btn = "true" id = "src1">

         <h2>Color Input Example</h2>
         <label for = "src2">Color Input</label>
         <input type = "color" id = "src2" data-clear-btn = "false">
         
         <label for = "src3">Clear the Color Field</label>
         <input type = "color" data-clear-btn = "true" id = "src3">
      </form>
   </body>
</html>

輸出

執行以下步驟來看看上面的程式碼如何工作 −

  • 將以上 html 程式碼作為 textinput_time_color.html 檔案儲存在你的伺服器根資料夾中。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.