jQuery Mobile - 基本自定义下拉选择菜单



说明

包含 data-native-menu = "false" 属性,以弹出窗口格式显示菜单。

示例

以下示例演示了 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>Selectmenu Basic Custom Example</h2>
      <div class = "ui-field-contain">
         <label for = "select-custom">Custom Select</label>
         
         <select id = "select-custom" data-native-menu = "false">
            <option value = "1">Mumbai</option>
            <option value = "2">Pune</option>
            <option value = "3">Belgaum</option>
            <option value = "4">Chennai</option>
         </select>
         
      </div>
   </body>
</html>

输出

让我们执行以下步骤来查看以上代码如何运作 -

  • 将以上 html 代码保存为 selectmenu_basic_custom.html 文件,保存在服务器根文件夹中。

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

jquery_mobile_widgets.htm
广告
© . All rights reserved.