Open In App
Related Articles

jQuery Mobile Navbar initSelector Option

Improve Article
Save Article
Like Article

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 Navbar initSelector option. The value of this option is a selector string that picks elements on the basis of the value of this option and explicates the stated Navbar widgets on every element of the following list.


  • Initializing navbar with the specified initSelector option.
$( "Selector" ).navbar({ initSelector: "div.custom" });
  • Setting the initSelector option.
$( "Selector" ).navbar( "option", "initSelector", "div.custom" );
  • Getting the initSelector option.
var initSelector = $( "Selector" ).navbar( "option", "initSelector" );

CDN Link: First, add jQuery Mobile scripts needed for your project.

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

Example: This example describes the jQuery Mobile Navbar initSelector option.


<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content=
"width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    <script src=
        <div data-role="page">
            <h1 style="color:green;">
            <h3>jQuery Mobile Navbar initSelector Option</h3>
            <div id="divID">
                <div data-role="header">
                <div role="main" class="ui-content">
                <div data-role="footer">
                    <div data-role="navbar">
                            <li><a href="#" class="ui-btn-active">GFG</a></li>
                            <li><a href="#">gfg</a></li>
            <input type="button" id="Button" 
                   value="Value of the initSelector Option">
            <div id="log"></div>
        $(document).ready(function () {
                initSelector: ":jqmData(role='navbar')"
            $("#divID").navbar("option", "initSelector", ":jqmData(role='navbar')");
            $("#Button").on('click', function () {
                var a = $("#divID").navbar("option", "initSelector");




Last Updated : 14 May, 2022
Like Article
Save Article
Similar Reads
Related Tutorials