IBM Developerworks, Written by Kris Hadlock
Creating simple lists
Lists are a common element to see on a mobile website. With jQuery Mobile, you can create a number of different list formats, such as basic linked lists, nested lists, numbered lists, split button lists, lists with dividers, lists with icons, thumbnail or count bubbles, and lists that include a search filter bar. A common list type to use is a basic linked list. To create a basic linked list, you simply need to create a standard HTML unordered list, add a data-role
attribute, and assign it a value of listview
(Listing 6).
<ul data-role="listview"> <li><a href="#">List item 1</a></li> <li><a href="#">List item 2</a></li> </ul>
To create a numbered list, you would use the same code as in Listing 6, simply changing the ul
to ol
to convert it to an ordered list.