jQuery Mobile Button Icons
jQuery Mobile provides a set of icons that make buttons look more appealing.
Adding icons to jQuery Mobile buttons
We can use the ui-icon class to add an icon to a button, and use specific classes to set the button position.
Search
Note: For buttons in other methods, such as buttons in lists or forms, you need to use the data-icon attribute. We will introduce these in detail in the next chapters.
Below we list some of the available icons provided by jQuery Mobile:
| Buttons | Description | button | Example |
|---|---|---|---|
| ui-icon-arrow-l | Left arrow | Try it | |
| ui-icon-arrow-r | Right arrow | Try it | |
| ui-icon-info | Information | Try it | |
| ui-icon-delete | Delete | Try it | |
| ui-icon-back | Backspace | Try it | |
| ui-icon-audio | Speaker | Try it | |
| ui-icon-lock | Padlock | Try it | |
| ui-icon-search | Search | Try it | |
| ui-icon-alert | Warning | Try it | |
| ui-icon-grid | Grid | Try it | |
| ui-icon-home | Home | Try it |
For a complete reference manual of all jQuery Mobile button icons, visit our jQuery Mobile Icon Reference Manual。
Position icons
You can also specify where the icon is positioned on the button: top, right, bottom, left.
Use the ui-btn-icon attribute to specify the position:
Icon positions:
![]() |
If you do not specify the position of the button icon, the icon will not be displayed. |
|---|
Show icons only
If you only want to display the icon, you can use "notext":
Example:
Search Try it » By default, all icons have a gray circle. If you don't need it, you can use the "ui-nodisc-icon" class on the element:
Without circle Try it » By default, all icons are white. If you need to change the icon color to black, you can add "ui-alt-icon" to the element:
black Try it » Add the "ui-nodisc-icon" class to the container
Add the "ui-alt-icon" class to the container
Remove the circle
Example
Black and white buttons
Example
More examples
An example of using the "ui-nodisc-icon" class.
An example of using the "ui-alt-icon" class.
