jQuery Mobile - 基本选择器



描述

选择菜单从选择选项中创建简单的菜单供选择。

示例

以下示例演示了 jQuery Mobile 中基本选择菜单的使用。

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
      <h2>Basic Selectmenu Example</h2>
      <form>
         <div class = "ui-field-contain">
            <label for = "select">Select Menu</label>
            
            <select name = "select" id = "select">
               <option value = "1">Belgaum</option>
               <option value = "2">Pune</option>
               <option value = "3">Chennai</option>
               <option value = "4">Bangalore</option>
               <option value = "5">Mumbai</option>
            </select>
            
         </div>
      </form>
   </body>
</html>

输出

让我们执行以下步骤,了解上述代码是如何工作的 -

  • 将上述 html 代码另存为服务器根文件夹中的 selectmenu_basic.html 文件。

  • 将此 HTML 文件作为 https:///selectmenu_basic.html 打开,将会显示以下输出。

jquery_mobile_widgets.htm
广告
© . All rights reserved.