Skip to content
Related Articles

Related Articles

jQuery Mobile Listview autodividersSelector Option

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 30 Jan, 2022

jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops.

In this article, we will be using the jQuery Mobile Listview autodividersSelector option. This option is given by the “listview.autodividers” extension and the value of this option is a function that returns a string. It receives a jQuery collection object containing an element. It computes the returned string from the element. The function is called for each list item in the sequence, and a divider is created whenever the function returns a value for a list item that is different from the value it returned for the previous list item.


Initializing the Listview with the autodividersSelector option.

$( ".selector" ).listview({
    autodividersSelector: function ( li ) {
         var out = /* generate a string */;
         return out;

Getting the autodividersSelector option.

var autodividersSelector = $( ".selector" )
.listview( "option", "autodividersSelector" );

CDN Link: Add the following jQuery Mobile scripts that you will need in your project.

<link rel=”stylesheet” href=”//”>
<script src=”//”></script>
<script src=”//”></script>

Example: This example demonstrates the jQuery Mobile Listview autodividersSelector option.


<!doctype html>
<html lang="en">
    <link rel="stylesheet" href=
    <script src=
    <script src=
        <div data-role="page">
            <h1 style="color:green;">
            <h3>jQuery Mobile Listview 
                autodividersSelector Option</h3>
            <div id="divID">
                <div role="main" class="ui-content">
                    <ul data-role="listview">
                          <a href="index.html">
                        <li><a href="index.html">GFG</a></li>
                        <li><a href="index.html">gfg</a></li>
            <input type="button" id="Button"
                value="Value of the autodividersSelector Option">
            <div id="log"></div>
        $(document).ready(function () {
                  autodividers: true,
                  autodividersSelector: function ( li ) {
                    var out = "autodividersSelector";
                    return out;
            $("#Button").on('click', function () {
                var a = $("#divID").listview(
                  "option", "autodividersSelector"


jQuery Mobile Listview autodividersSelector option


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!