GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 首页
  • HTML
  • JavaScript
  • CSS
  • React
  • Python3
  • Java
  • C
  • C++
  • C#
  • Go
  • SQL
  • Linux
  • VS Code

This view

  • Original page
  • New address

GeezerVison is showing www.runoob.com — jQuery Mobile 表单 | 菜鸟教程

菜鸟教程 -- 学的不仅是技术,更是梦想!

  • Vue3 教程
  • Vue2 教程
  • Bootstrap3
  • Bootstrap4
  • Bootstrap5
  • 机器学习
  • PyTorch
  • TensorFlow
  • Sklearn
  • NLP
  • AI Agent
  • Ollama
  • Coding Plan
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 可折叠块 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 主题

jQuery Mobile 事件

jQuery Mobile 事件 jQuery Mobile 触摸事件 jQuery Mobile 滚屏事件 jQuery Mobile 方向改变事件 jQuery Mobile 实例 jQuery Mobile Data 属性 jQuery Mobile 图标 jQuery Mobile 事件 jQuery Mobile页面事件 jQuery Mobile CSS 类
jQuery Mobile 触摸事件
jQuery Mobile 表单输入

jQuery Mobile 表单


jQuery Mobile 会自动为 HTML 表单自动添加样式,让它们看起来更具吸引力,触摸起来更具友好性。




jQuery Mobile 表单结构

jQuery Mobile 使用 CSS 为 HTML 表单元素添加样式,让它们更具吸引力,更易于使用。

在 jQuery Mobile 中,您可以使用下列表单控件:

  • 文本输入框
  • 搜索输入框
  • 单选按钮
  • 复选框
  • 选择菜单
  • 滑动条
  • 翻转拨动开关

当使用 jQuery Mobile 表单时,您应当知道:

  • <form> 元素必须有一个 method 和一个 action 属性
  • 每个表单元素必须有一个唯一的 "id" 属性。id 必须是整个站点所有页面上唯一的。这是因为 jQuery Mobile 的单页导航机制使得多个不同页面在同一时间被呈现
  • 每个表单元素必须有一个标签。设置标签的 for 属性来匹配元素的 id

实例

<form method="post" action="demoform.html">
<label for="fname">姓名:</label>
<input type="text" name="fname" id="fname">
</form>

尝试一下 »

如需隐藏标签,请使用 class ui-hidden-accessible。这在您把元素的 placeholder 属性作为标签时经常用到:

实例

<form method="post" action="demoform.html">
<label for="fname" class="ui-hidden-accessible">姓名:</label>
<input type="text" name="fname" id="fname" placeholder="姓名...">
</form>

尝试一下 »

提示: 我们可以使用 data-clear-btn="true" 属性来添加清除输入框内容的按钮 (一个在输入框右侧的 X 图标):

实例

<label for="fname">姓名:</label>
<input type="text" name="fname" id="fname" data-clear-btn="true">

尝试一下 »
Note 清除输入框的按钮可以在 <input> 元素中使用,但不能在 <textarea> 中使用。 搜索框中 data-clear-btn 默认值为 "true" ,你可以使用 data-clear-btn="false" 移除该图标。

jQuery Mobile 表单图标

表单中的按钮代码是标准的 HTML <input> 元素 (button, reset, submit)。他们会自动渲染样式,可以自动适配移动设备与桌面设备:

实例

<input type="button" value="按钮">
<input type="reset" value="重置按钮">
<input type="submit" value="提交按钮">

尝试一下 »

如果需要在 <input> 按钮中添加额外的样式,可以使用下表中的 data-* 属性:

属性 值 描述
data-corners true | false 指定按钮是否有圆角
data-icon 图标参考手册 指定按钮图标
data-iconpos left | right | top | bottom | notext 指定图标位置
data-inline true | false 指定是否内联按钮
data-mini true | false 指定是否为迷你按钮
data-shadow true | false 指定按钮是否添加阴影效果

按钮添加图标:

<input type="button" value="按钮">
<input type="reset" value="重置按钮">
<input type="submit" value="提交按钮">

尝试一下 »

字段容器

如需让标签和表单元素看起来更适应宽屏,请用带有 "ui-field-contain" 类的 <div> 或 <fieldset> 元素包围 label/form 元素:

实例

<form method="post" action="demoform.php">
  <div class="ui-field-contain">
    <label for="fname">姓:</label>
    <input type="text" name="fname" id="fname">
    <label for="lname">姓:</label>
    <input type="text" name="lname" id="lname">
  </div>
</form>

尝试一下 »

lamp ui-field-contain 类基于页面的宽度为标签和表单控件添加样式。当页面的宽度大于 480px 时,它会自动把标签放置在与表单控件同一线上。当页面的宽度小于 480px 时,标签会被放置在表单元素的上面。

提示:为了防止 jQuery Mobile 为可点击元素自动添加样式,请使用 data-role="none" 属性:

实例

<label for="fname">姓名:</label>
<input type="text" name="fname" id="fname" data-role="none">

尝试一下 »

lamp jQuery Mobile 中的表单提交

jQuery Mobile 通过 AJAX 自动处理表单提交,并将试图集成服务器响应到应用程序的 DOM 中。
AI 思考中...
jQuery Mobile 触摸事件
jQuery Mobile 表单输入

点我分享笔记

取消

  • 昵称 (必填)
  • 邮箱 (必填)
  • 引用地址
分类导航
  • Python / 数据科学
    • Python 教程
    • Python2.x 教程
    • FastAPI 教程
    • Flask 教程
    • Django 教程
    • NumPy 教程
    • Pandas 教程
    • SciPy 教程
    • Matplotlib 教程
    • Dash 教程
    • Jupyter Notebook 教程
    • Pillow 教程
    • 量化交易
    • R 教程
    • Julia 教程
  • AI / 智能开发
    • AI Agent(智能体)
    • AI(人工智能)
    • AI 应用案例
    • Codex 教程
    • Vibe Coding 教程
    • Claude Code
    • OpenCode
    • Skills(技能)
    • Ollama 教程
    • Hermes Agent
    • DeepSeek Harness
    • Pi Agent
    • AI 数学基础
    • TensorFlow 教程
    • PyTorch 教程
    • Scikit-learn 教程
    • 机器 教程
    • LangChain
    • 自然语言处理 NLP
    • OpenCV 教程
    • Selenium 教程
    • Playwright 教程
  • 前端开发
    • HTML 教程
    • HTML5 教程
    • CSS 教程
    • CSS3 教程
    • JavaScript 教程
    • HTML DOM 教程
    • TypeScript 教程
    • AJAX 教程
    • JSON 教程
    • Tailwind CSS 教程
    • Bootstrap4 教程
    • Bootstrap5 教程
    • Bootstrap6 教程
    • Foundation 教程
    • Vue.js 教程
    • Vue3 教程
    • React 教程
    • Next.js 教程
    • Three.js 教程
    • AngularJS 教程
    • Angular 教程
    • jQuery 教程
    • jQuery UI 教程
    • jQuery EasyUI 教程
    • ECharts 教程
    • Chart.js 教程
    • Highcharts 教程
    • Google 地图 教程
    • SVG 教程
    • Font Awesome 教程
  • 后端开发
    • Node.js 教程
    • Electron 教程
    • PHP 教程
    • Java 教程
    • Go 教程
    • Rust 教程
    • C# 教程
    • Unity 教程
    • Servlet 教程
    • JSP 教程
    • ASP 教程
    • AppML 教程
    • VBScript 教程
    • Swagger 教程
    • RESTful API 教程
    • Docker 教程
    • Linux 教程
    • ZooKeeper 教程
  • 数据库
    • SQL 教程
    • MySQL 教程
    • PostgreSQL 教程
    • SQLite 教程
    • MongoDB 教程
    • Redis 教程
    • Memcached 教程
  • 移动开发
    • Android 教程
    • Flutter 教程
    • Ionic 教程
    • jQuery Mobile 教程
    • Swift 教程
    • Kotlin 教程
  • DevOps / 工程化
    • Git 教程
    • SVN 教程
    • CMake 教程
    • Maven 教程
    • VS Code 教程
    • Obsidian 教程
    • PyCharm 教程
    • Eclipse 教程
    • Markdown 教程
    • LaTeX 教程
  • 编程语言
    • C 教程
    • C++ 教程
    • Zig 教程
    • Scala 教程
    • Ruby 教程
    • Perl 教程
    • Lua 教程
    • Dart 教程
    • 汇编语言 教程
    • Verilog 教程
  • 计算机基础
    • 计算机组成原理
    • 数据结构与算法
    • C 语言数据结构与算法
    • 设计模式
    • Python 设计模式
    • 正则表达式
    • HTTP 教程
    • TCP/IP 教程
    • 网络协议
    • W3C 教程
  • XML / Web Service
    • XML 教程
    • DTD 教程
    • XML DOM 教程
    • XSLT 教程
    • XPath 教程
    • XQuery 教程
    • XLink 教程
    • XPointer 教程
    • XML Schema 教程
    • XSL-FO 教程
    • Web Service 教程
    • WSDL 教程
    • SOAP 教程
    • RSS 教程
    • RDF 教程
  • .NET
    • ASP.NET 教程
    • MVC 教程
    • Razor 教程
    • Web Forms 教程
    • Web Pages 教程
    • PowerShell 教程
  • 网站建设
    • 网站建设指南
    • 浏览器信息
    • 网站主机教程
    • 网站品质

字节 Coding Plan 限时 9.9 元起,支持 Deepseek-V4、GLM-5.3、Doubao-Seed-Evolving、Kimi-K3。
百度 Dumate 百度推出的桌面级 AI 智能体。 输入激活码送 4000 积分
使用文档
Trae AI 原生开发环境,让编程更高效。新用户注册赠2500积分,管理项目,也交付成果。
Advertisement
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.