jQuery Mobile - 文字輸入網址和密碼



說明

url 輸入型別僅接受網址值。此型別用於應包含網址地址的輸入欄位。

密碼輸入型別用於建立隱藏文字控制元件,它是敏感資訊的欄位。

示例

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

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

輸出

讓我們執行以下步驟,瞭解上述程式碼如何工作 -

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

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.