本文实例讲述了jquery-mobile表单的创建方法。分享给大家供大家参考,具体如下:
1.
2. 每个表单元素必须设置唯一的 "id" 属性。
该 id 在站点的页面中必须是唯一的。
这是因为 jQuery Mobile 的单页面导航模型允许许多不同的“页面”同时呈现。
3. 每个表单元素必须有一个标记(label)。
请设置 label 的 for 属性来匹配元素的 id。
【文本框】
data-role="fieldcontain" 大于480px 自动与label 同到一行
如果不希望使用 jquery-mobile的样式
【搜索框】
加上data-role="fieldcontain" 一行 不加每个标签一行
【单选框】
【复选框】
[注意]:单复选水平分组
可在fieldset 标签中添加属性
预选某个按钮 可以使用:
input 的 checked
【选择菜单】
普通选择菜单,有点丑
使用属性:
【多选菜单】
需要使用自定义的
【滑动条】
max - 规定允许的最大值 min - 规定允许的最小值 step - 规定合法的数字间隔 value - 规定默认值
【翻转切换开关】
默认选中可加 selected
【主题样式】
a 默认。黑色背景上的白色文本。 b 蓝色背景上的白色文本 / 灰色背景上的黑色文本 c 亮灰色背景上的黑色文本 d 白色背景上的黑色文本 e 橙色背景上的黑色文本
一般情况下 使用上面的颜色 可以直接使用属性
如果要改变对话框(遮罩)的背景色
data-overlay-theme="e" (放在page上)
改变可折叠的背景颜色
data-theme="b" data-content-theme="e" (放在collapsible)
主题划分按钮
data-split-theme="e" (放在 listview)
【添加新样式】
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《》、《》、《》、《》、《》、《》及《用法总结》
希望本文所述对大家jQuery程序设计有所帮助。