Easy Fix
To quickly solve this issue, simply insert the li
tag before any traditional listview
elements in your code:
For example:
<li data-role="list-divider">Place text here</li>
Automated Solution
An alternative method is to let the system handle it by adding the attribute data-autodividers="true"
to your listview's main ul
tag.
For instance:
<ul data-role="listview" data-autodividers="true" data-filter="true" data-inset="true">
<li><a href="index.html">Adam Kinkaid</a></li>
<li><a href="index.html">Alex Wickerham</a></li>
<li><a href="index.html">Avery Johnson</a></li>
<li><a href="index.html">Bob Cabot</a></li>
<li><a href="index.html">Caleb Booth</a></li>
<li><a href="index.html">Christopher Adams</a></li>
<li><a href="index.html">Culver James</a></li>
</ul>
Another Option
See a live demonstration: http://jsfiddle.net/Gajotres/JHDsq/
$(document).on('pagecreate', '#index', function(){
$( "#mylistview li" ).each(function() {
$(this).before('<li data-role="list-divider"></li>');
});
});
This approach will add dividers above existing li
elements. Also note the use of data-divider-theme="a"
, which creates black dividers.