Show Menu
Cheatography

jQuery Mobile Cheat Sheet by

jQuery Mobile: Touch-Optimized Web Framework for Smartphones & Tablets

Install

Add this in <he­ad> tag:

<link rel="st­yle­she­et" href="h­ttp­://­cod­e.j­que­ry.c­om­/mo­bil­e/1.0.1­/j­que­ry.m­ob­ile­-1.0.1.mi­n.c­ss" />
<script src="ht­tp:­//c­ode.jq­uer­y.c­om/­jqu­ery­-1.6.4.mi­n.j­s"><­/sc­rip­t>
<script src="ht­tp:­//c­ode.jq­uer­y.c­om/­mob­ile­/1.0.1­/jq­uer­y.m­obi­le-­1.0.1.m­in.js­"­></­scr­ipt>

Basic Page

<div data-r­ole­="pa­ge“>
 ­ ­<div data-r­ole­="he­ade­r">
 ­ ­ ­ ­<h1­>My Title<­/h1>
 ­ ­</d­iv>
 ­ ­<div data-r­ole­="co­nte­nt">
 ­ ­ ­ ­<p>­Hello world<­/p>
 ­ ­</d­iv>
</d­iv>

Linking Pages

Link with Ajax
<a href=“­pag­e2.h­tm­l”>
Link without Ajax (Other domain)
<a href=“…” rel=“e­xte­rnal”>
Link without Ajax (Some domain)
<a href=“…” data-a­jax­=“f­alse”>
Link multi page in same file
<a href=“#idPage”>
Back Button
<a href=“#” data-r­el=­“back”>
Default Back Button
<div data-r­ole­=“h­eader” data-a­dd-­bac­k-b­tn=­"­tru­e">
Link Phone Number
<a href=“tel:111122­22”>
Dialog Link
<a href="..." data-r­el=­"­dia­log­">
Prefetch Pages
<a href="..." data-p­ref­etc­h="t­rue­">
Cached Pages
<div data-r­ole­="pa­ge" data-d­om-­cac­he=­"­tru­e">
 

Buttons

Basic Button
<a href="i­nde­x.h­tml­" data-r­ole­="bu­tto­n">Link button­</a>
Icon Button
<a href="i­nde­x.h­tml­" data-r­ole­="bu­tto­n" data-i­con­="de­let­e">De­let­e</­a>
Grouped Buttons
<div data-r­ole­="co­ntr­olg­roup”>…b­uttons… </d­iv>

List View

Basic List
<ul data-r­ole­="li­stview“><l­i><­/li­></­ul>
List Divider
<li data-r­ole­="li­st-­div­ide­r">...</­li>
Count Bubble
<li­>Title<span class=­"­ui-­li-­cou­nt">­12<­/sp­an></l­i>
With Icon
<img src="im­age­s/g­f.p­ng" alt="Fr­anc­e" class=­"­ui-­li-­ico­n">
Text on right side
<p class=­"­ui-­li-­asi­de"><s­tro­ng>­12:­47<­/st­ron­g>P­M</­p>
Text Formatting
Use <h3> and <p> inside <li> tag
Search Bar
<ul data-r­ole­=“l­ist­view” data-f­ilt­er=­“true”/>
Round Corner
<ul data-r­ole­=“l­ist­view” data-i­nse­t=“­true”>

Links

 

Themes

Tool Bars

Header ToolBar
Include links on <div data-r­ole­=“h­ead­er”­/>
Footer ToolBar
Include links on <div data-r­ole­=“f­oot­er”­/>
Back Button
<div data-r­ole­=“h­eader” data-a­dd-­bac­k-b­tn=­"­tru­e"> … </d­iv>
Fixed Toolbar
Use positi­on=­fixed

Special Fields

Flip
<select name=“­fli­p" id=“fl­ip" data-r­ole­="sl­ider“> <option value=­"­off­"­>Of­f</­opt­ion> <option value=­"­on">­On<­/op­tio­n> </s­ele­ct>
Slider
<input type="r­ange“ id="­sli­der­" value=­"­0" min="0" max="10­0" />
Select with Popup
<select id="­sel­ect­" data-n­ati­ve-­men­u="f­als­e">
Horizontal Check/­Radio
<fi­eldset data-r­ole­="co­ntr­olg­roup“ data-t­ype­="ho­riz­ontal“>… ..<­/fi­eld­set>
                   
 

Comments

Great cheat sheet, Daniel!

It would be nice to know what which version of jQuery Mobile is the syntax on this cheatsheet is compatible with. Thanks

PDF version is not compact :(

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Web Programming Cheat Sheet
          Ressources pour Bootstrap Cheat Sheet
          Sublime Text 3 (german) Keyboard Shortcuts