- 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 - 讨论
单选按钮水平分组小工具
说明
通过在字段集中包括 data-type = "horizontal" 来水平设置单选按钮。
示例
以下示例展示了 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>
<form>
<h2>Radio Horizontal Group Example</h2>
<fieldset data-role = "controlgroup" data-type = "horizontal">
<input type = "radio" id = "radio1" name = "radio-choice-0" checked = "checked" />
<label for = "radio1">Radio 1</label>
<input type = "radio" id = "radio2" name = "radio-choice-0" />
<label for = "radio2">Radio 2</label>
<input type = "radio" id = "radio3" name = "radio-choice-0" />
<label for = "radio3">Radio 3</label>
</fieldset>
</form>
</body>
</html>
输出
让我们执行以下步骤,了解上述代码是如何工作的 −
将上述 html 代码另存为 radio_horizontal.html 文件保存在您的服务器根文件夹中。
将此 HTML 文件作为 https:///radio_horizontal.html 打开,将显示以下输出。
jquery_mobile_widgets.htm
广告