- jQuery 移動版教程
- jQuery 移動版 - 主頁
- jQuery 移動版 - 概述
- jQuery 移動版 - 安裝
- jQuery 移動版 - 頁面
- jQuery 移動版 - 圖示
- jQuery 移動版 - 轉場
- jQuery 移動版 - 佈局
- jQuery 移動版 - 小元件
- jQuery 移動版 - 事件
- jQuery 移動版 - 表單
- jQuery 移動版 - 主題
- jQuery 移動版 - CSS 類
- jQuery 移動版 - 資料屬性
- jQuery 移動版的有用的資源
- jQuery 移動版 - 面試問題
- jQuery 移動版 - 快速指南
- jQuery 移動版 - 有用的資源
- jQuery 移動版 - 討論
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>
<div data-role = "page">
<div data-role = "header">
<h2>Form Custom Select Menus</h2>
</div>
<div data-role = "main" class = "ui-content">
<form method = "post" action = "jquery_mobile/demo.php">
<fieldset class = "ui-field-contain">
<label for = "select-custom">Custom Select</label>
<select id = "select-custom" data-native-menu = "false" name = "fname">
<option value = "Mumbai">Mumbai</option>
<option value = "Pune">Pune</option>
<option value = "Belgaum">Belgaum</option>
<option value = "Chennai">Chennai</option>
<option value = "Bangalore">Bangalore</option>
</select>
</fieldset>
<input type = "submit" value = "Submit" data-inline = "true">
</form>
</div>
</div>
</body>
</html>
輸出
讓我們按照以下步驟瞭解上述程式碼是如何工作的 -
將上述 html 程式碼另存為伺服器根資料夾中的 bform_custom_select_menus.html 檔案。
將此 HTML 檔案開啟為 https:///form_custom_select_menus.html,將顯示以下輸出。
jquery_mobile_forms.htm
廣告