jQuery Mobile - 小型文字輸入



說明

包含屬性 data-mini = "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>
      <form>
         <h2>Text mini Input Example</h2>
         <label for = "src">Text Input</label>
         <input type = "text" id = "src" data-clear-btn = "false" data-mini = "true">

         <label for = "src1">Clear the Text mini Field</label>
         <input type = "text" data-clear-btn = "true" id = "src1" data-mini = "true">

         <label for = "src2">Search mini Input</label>
         <input type = "search" id = "src2" data-mini = "true">

         <label for = "src3">Textarea mini Field</label>
         <textarea type = "textarea" id = "src3" data-mini = "true"></textarea>
      </form>
   </body>
</html>

輸出

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

  • 將上述 html 程式碼儲存為 textinput_mini.html 檔案,儲存在伺服器根資料夾中。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.