jQuery Mobile - Listview Split buttons


Include a second link inside the li to create split list item. data-split-icon attribute is used to adjust the split button icon and data-split-theme attribute is used to include theme for the split button.


Following example demonstrates the use of split button in the 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>Listview Split Button Example</h2>
      <ul data-role = "listview" data-split-icon = "gear" data-split-theme = "a" 
         data-inset = "true">
         <li><a href = "#">
            <img src = "/jquery_mobile/images/facebook.jpg">
            <p>Mark Zukerburg</p></a>
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" data-transition = "pop">Login</a>
         <li><a href = "#"><img src = "/jquery_mobile/images/twitter.jpg">
            <p>Jack Dorsey</p></a>
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" data-transition = "pop">Login</a>
         <li><a href = "#"><img src = "/jquery_mobile/images/google.jpg">
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" data-transition = "pop">Login</a>

      <div data-role = "popup" id = "purchase" data-theme = "a" data-overlay-theme = "b" 
         class = "ui-content">
         <h3>Social Media Sites</h3>
         <p>Login in your mobile device</p>
         <a href = "index.html" data-rel = "back" class = "ui-shadow ui-btn ui-btn-b ui-icon-check 
            ui-btn-icon-left ui-btn-inline ui-mini">LOGIN</a>
         <a href = "index.html" data-rel = "back" class = "ui-shadow ui-btn ui-btn-inline 


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

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

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

Kickstart Your Career

Get certified by completing the course

Get Started