Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile Button Icons

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:

Top

Right pane

Footer

Left pane

Try it »

Note 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 »


Remove the circle

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:

Example

With circle (default)

Without circle

Try it »


Black and white buttons

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:

Example

white

black

Try it »


More examples

Add the "ui-nodisc-icon" class to the container
An example of using the "ui-nodisc-icon" class.

Add the "ui-alt-icon" class to the container
An example of using the "ui-alt-icon" class.