jQuery Mobile - Listview Count bubbles


ui-li-count class define in element will help to include a count indicator in the list item on the right side. Add data-count-theme attribute to set the theme for count bubbles in the list.


Following example demonstrates the use of count bubble list in the jQuery Mobile.

<!DOCTYPE html>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

      <h2>Count Bubble List Example</h2>
      <ul data-role = "listview" data-count-theme = "b" data-inset = "true">
         <li><a href = "#">Inbox<span class = "ui-li-count">100</span></a></li>
         <li><a href = "#">Starred<span class = "ui-li-count">5</span></a></li>
         <li><a href = "#">Important<span class = "ui-li-count">2</span></a></li>
         <li><a href = "#">Chats<span class = "ui-li-count">6</span></a></li>
         <li><a href = "#">Sent Mail<span class = "ui-li-count">20</span></a></li>
         <li><a href = "#">Drafts<span class = "ui-li-count">12</span></a></li>


Let's carry out the following steps to see how the above code works −

  • Save the above html code as listview_count_bubbles.html file in your server root folder.

  • Open this HTML file as http://localhost/listview_count_bubbles.html and the following output will be displayed.

Kickstart Your Career

Get certified by completing the course

Get Started