qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請訪問 http://qaseven.github.io/

          jQuery Mobile 表單

          jQuery Mobile 會自動為 HTML 表單添加優(yōu)異的便于觸控的外觀。

          jQuery Mobile 表單結(jié)構(gòu)

          jQuery Mobile 使用 CSS 來設(shè)置 HTML 表單元素的樣式,以使其更有吸引力更易用。

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

          • 文本框
          • 搜索框
          • 單選框
          • 復選框
          • 選擇菜單
          • 滑動條
          • 翻轉(zhuǎn)切換開關(guān)

          當您與 jQuery Mobile 表單打交道時,應該了解以下信息:

          • <form> 元素必須設(shè)置 method 和 action 屬性
          • 每個表單元素必須設(shè)置唯一的 "id" 屬性。該 id 在站點的頁面中必須是唯一的。這是因為 jQuery Mobile 的單頁面導航模型允許許多不同的“頁面”同時呈現(xiàn)。
          • 每個表單元素必須有一個標記(label)。請設(shè)置 label 的 for 屬性來匹配元素的 id。

          實例

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

          親自試一試

          如需隱藏 label,請使用類 ui-hidden-accessible。這很常用,當您需要元素的 placeholder 屬性充當 label 時:

          實例

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

          親自試一試

          域容器

          如果需要 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 屬性基于頁面寬度來設(shè)置 label 和表單控件的樣式。當頁面寬度大于 480px 時,它會自動將 label 與表單控件放置于同一行。當小于 480px 時,label 會被放置于表單元素之上。

          提示:如需避免 jQuery Mobile 自動為可點擊元素設(shè)置樣式,請使用 data-role="none" 屬性:

          實例

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

          親自試一試

          在 jQuery Mobile 中提交表單

          提示:jQuery Mobile 會自動通過 AJAX 進行表單提交,并會嘗試將服務器響應整合入應用程序的 DOM 中。

          posted on 2014-05-21 18:24 順其自然EVO 閱讀(177) 評論(0)  編輯  收藏 所屬分類: jQuery Mobile 教程

          <2025年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          導航

          統(tǒng)計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 大丰市| 扎兰屯市| 绥江县| 太仆寺旗| 外汇| 定远县| 江津市| 黄浦区| 阿拉尔市| 五台县| 基隆市| 恩平市| 北京市| 江孜县| 正镶白旗| 霍州市| 南城县| 吉隆县| 得荣县| 东台市| 芜湖县| 铜鼓县| 汶上县| 芦溪县| 双桥区| 云和县| 高邮市| 宕昌县| 体育| 乌鲁木齐市| 论坛| 大渡口区| 沾益县| 南昌市| 阳信县| 古蔺县| 宁乡县| 本溪| 桑植县| 台安县| 长阳|