jQuery Mobile - 文字輸入框文字和文字區域



說明

  • 文字型別輸入允許使用者輸入單行文字。
  • <textarea> 標記允許使用者在多行上輸入文字。

示例

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

         <h2>Textarea Example</h2>
         <textarea type = "textarea" id = "txt"></textarea>
      </form>
   </body>
</html>

輸出

讓我們執行以下步驟,看看上面的程式碼是如何工作的 -

  • 將上述 HTML 程式碼另存為伺服器根資料夾中的 textinput_text.html 檔案。

  • 使用 https:///textinput_text.html 開啟這個 HTML 檔案,並將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.