jQuery 移動端 - 文字輸入搜尋



說明

搜尋輸入型別可幫助使用者在特定頁面中查詢內容。

示例

以下示例演示瞭如何使用 jQuery 移動端中的搜尋輸入。

<!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>Search Input Example</h2>
         <input type = "search" id = "src">
      </form>
   </body>
</html>

輸出

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

  • 將以上 html 程式碼另存為 textinput_search.html 檔案,並將其儲存到伺服器根資料夾中。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.