Jquery Mobile表单
三个前提:
1、每个form必须设置method和action属性
2、每个form必须有页面范围内唯一的id标识
3、每个form必须有一个label标签,通过设置它的for属性来匹配元素的id
<form method="post" action="demoform.asp">
<label for="fname">First name:</label>
<input type="text" name="fname" id="fname">
</form>
1、隐藏label内容:
<form method="post" action="demoform.asp">
<label for="fname" class="ui-hidden-accessible">姓名:</label>
<input type="text" name="fname" id="fname" placeholder="姓名...">
</form>
2、域容器:
如果需要 label 和表单元素在宽屏幕上显示正常,用带有 data-role="fieldcontain" 属性的 <div> 或<fieldset>包装 label 或表单元素:
<form method="post" action="demoform.asp">
<div data-role="fieldcontain">
<label for="fname">First name:</label>
<input type="text" name="fname" id="fname">
<label for="lname">Last name:</label>
<input type="text" name="lname" id="lname">
</div>
</form>
fieldcontain 属性基于页面宽度来设置 label 和表单控件的样式。当页面宽度大于 480px 时,它会自动将 label 与表单控件放置于同一行。当小于 480px 时,label 会被放置于表单元素之上。
3、单选按钮:
<form method="post" action="demoform.asp">
<div data-role="controlgroup">
<legend>Choose your gender:</legend>
<label for="male">Male</label>
<input type="radio" name="gender" id="male" value="male">
<label for="female">Female</label>
<input type="radio" name="gender" id="female" value="female">
</div>
</form>
<!-- 需要添加label和id -->
4、表单选择:
<!-- 分组 -->
<select name="day" id="day">
<optgroup label="Weekdays">
<option value="mon">Monday</option>
<option value="tue">Tuesday</option>
<option value="wed">Wednesday</option>
</optgroup>
<optgroup label="Weekends">
<option value="sat">Saturday</option>
<option value="sun">Sunday</option>
</optgroup>
</select>
<!-- 多选 -->
<select name="day" id="day" multiple data-native-menu="false">
5、滑块:
<form method="post" action="demoform.asp">
<div data-role="fieldcontain">
<label for="points">Points:</label>
<input type="range" data-highlight="true" name="points" id="points" value="50" min="0" max="100">
</div>
</form>
6、切换开关:
<form method="post" action="demoform.asp">
<div data-role="fieldcontain">
<label for="switch">Toggle Switch:</label>
<select name="switch" id="switch" data-role="slider">
<option value="on" selected>On</option>
<option value="off">Off</option>
</select>
</div>
</form>
tips:清除JQM自动样式:data-role:none
jQuery Mobile 会自动通过 AJAX 进行表单提交
Jquery Mobile表单的更多相关文章
- jQuery Mobile 表单基础
jQuery Mobile 会自动为 HTML 表单添加优异的便于触控的外观. jQuery Mobile 表单结构 jQuery Mobile 使用 CSS 来设置 HTML 表单元素的样式,以使其 ...
- 通过AJAX和PHP,提交JQuery Mobile表单
File name: callajax.php <?php $firstName = $_POST[firstName]; $lastName = $_POST[lastName]; echo( ...
- (四)Jquery Mobile表单
Jquery Mobile表单与列表 一.JM表单 1.表单 普通html表单 效果: 2.只能输入数字的表单 效果: ...
- jquery mobile 表单提交 图片/文件 上传
jquerymobile 下面 form 表单提交 和普通html没区别,最主要是 <form 要加一个 data-ajax='false' 否则 上传会失败 1 html代码 <!do ...
- jQuery Mobile 表单输入元素
jQuery Mobile 文本输入 输入字段是通过标准的 HTML 元素编写的,jQuery Mobile 会为它们设置专门针对移动设备的美观易用的样式.您还可以使用新的 HTML5 <inp ...
- 主攻ASP.NET MVC4.0之重生:Jquery Mobile 表单元素
相关代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...
- jquery实现表单验证简单实例
/* 描述:基于jquery的表单验证插件. */ (function ($) { $.fn.checkForm = function (options) { var root = this; //将 ...
- ASP.NET MVC Jquery Validate 表单验证的多种方式
在我们日常开发过程中,前端的表单验证很重要,如果这块处理不当,会出现很多bug .但是如果处理的好,不仅bug会很少,用户体验也会得到很大的提升.在开发过程中我们可以不借助 JS 库,自己去手写 JS ...
- jQuery Form 表单提交插件-----formSerialize,fieldSerialize,fieldValue,resetForm,clearForm,clearFields的 应用
一.jQuery Form的其他api 1. formSerialize 将表单序列化成查询串.这个方法将返回一个形如: name1=value1&name2=value2的字符串.是否可 ...
随机推荐
- css瀏覽器私有前綴名
-webkit-:chrome,safari -o-:opera -moz-:firefox -ms-:ie
- MySQL——安装、配置、启动服务、
1.环境变量配置 将启动连接,加入环境变量中. mysqld :启动服务端 msysql -u 用户名 -p 密码 : 启动客户端 2.windows服务:一直在运行中 E:\wupeiqi\mys ...
- ES 6 系列 - 变量声明
let 和 const let 声明 (一)基本用法 let 声明的变量只在块级作用域内有效,出了该块则报错,最常见且适合的地方在 for 循环中: var a = []; for (var i = ...
- 包packages
packages里面如何跨模块导入路径: print(dir()) 可以看到__file__ print(os.path.abspaht(__file__)) 可以看到当前绝对路径 import sy ...
- vuex2.0 基本使用(2) --- mutation 和 action
我们的项目非常简单,当点击+1按钮的时候,count 加1,点击-1按钮的时候,count 减1. 1, mutation The only way to actually change state ...
- codeforces534B
Covered Path CodeForces - 534B The on-board computer on Polycarp's car measured that the car speed a ...
- 51-node-1649齐头并进(最短路)
题意:中文题,没啥坑点: 解题思路:这道题一开始以为要跑两个最短路,后来发现不用,因为如果给定了铁路的线路,那么,公路一定是n个节点无向图的补图,所以,铁路和公路之间一定有一个是可以直接从1到n的,我 ...
- Root test & Ratio test
几何级数(Geometric Series/Geometric Progression) Root test与Ratio test都依赖于几何级数求和理论,因此这里先讨论该理论. 在数学上,几何级数, ...
- 安卓Android基础四天
网页源码查看器 HttpURLConnection:用于发送和接受数据 ScrollView只能由一个孩子 消息机制的写法(***) anr Application not response 应用无响 ...
- Git神器使用相关
感谢 感谢作者的网站,本文所有的知识可以在上述网站了解到,讲的非常详细,感谢.(https://www.liaoxuefeng.com/wiki/0013739516305929606dd183612 ...