jQuery Mobile - 文字輸入值/文字



描述

輸入控制元件中的value = "" 屬性提供控制元件內部的初始值。

示例

以下示例演示了在 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>Value/Text Input Type Example</h2>
         <label for = "src">Value/Text Input</label>
         <input type = "text" id = "src" value = "John">

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

         <label for = "src2">Search Input Value</label>
         <input type = "search" id = "src2" value = "Search">

         <label for = "src3">Textarea Value/Text </label>
         <textarea type = "textarea" id = "src3">Textarea</textarea>
      </form>
   </body>
</html>

輸出

讓我們執行以下步驟,看看上面的程式碼如何執行 −

  • 將上面 HTML 程式碼另存為 server 根資料夾中的 textinput_value_text.html 檔案。

  • 開啟這個 HTML 檔案,方法是 https:///textinput_value_texte.html,將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.