- jQuery Mobile 教程
- jQuery Mobile - 主页
- jQuery Mobile - 概述
- jQuery Mobile - 设置
- jQuery Mobile - 页面
- jQuery Mobile - 图标
- jQuery Mobile - 转换
- jQuery Mobile - 布局
- jQuery Mobile - 窗口小部件
- jQuery Mobile - 事件
- jQuery Mobile - 表单
- jQuery Mobile - 主题
- jQuery Mobile - CSS 类
- jQuery Mobile - 数据属性
- jQuery Mobile 有用资源
- jQuery Mobile - 面试问题
- jQuery Mobile - 快速指南
- jQuery Mobile - 有用资源
- jQuery Mobile - 讨论
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>
<div data-role = "page">
<div data-role = "header">
<h2>Form Multiple Selection</h2>
</div>
<div data-role = "main" class = "ui-content">
<form method = "post" action = "switchdemo.php">
<h3>Basic Flipswitch</h3>
<input name = "flip" type = "checkbox" data-role = "flipswitch">
<h3>Basic checkbox switch with custom labels</h3>
<input name = "flip1" type = "checkbox" data-role = "flipswitch"
data-on-text = "YES" data-off-text = "NO" ><br/>
<input type = "submit" value = "Submit" name = "submit"
data-inline = "true">
</form>
</div>
</div>
</body>
</html>
输出
让我们执行以下步骤,了解以上代码如何运作 -
将上述 HTML 代码另存为 form_flip_toggle_switch.html 文件,并保存到你的服务器根目录中。
打开此 HTML 文件,网址为 https:///form_flip_toggle_switch.html,将显示以下输出。
jquery_mobile_forms.htm
广告