Skip to content
Related Articles

Related Articles

jQuery Mobile Toolbar addBackBtn Option

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 28 Dec, 2021

jQuery Mobile is a web technology built on top of jQuery. It is used to create responsive web applications and websites which are accessible on phones, tabs, and desktops.

In this article, we will use the jQuery Mobile Toolbar addBackBtn option. When the addBackBtn option is set to true, a back button will be added automatically to the header which will take the user to the previous page. This option adds a back button only to the header toolbar widget and does not affect the footer.


  addBackBtn: true


  • Get the addBackBtn option:

    var addBackBtn = $( ".selector" )
        .toolbar( "option", "addBackBtn" ); 
  • Set the addBackBtn option:

    $(".selector").toolbar( "option", "addBackBtn", true );

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

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

Example: In this example, we will set the addBackBtn option to true to add a back button to the header toolbar.


<!DOCTYPE html>
<html lang="en">
    <link rel="stylesheet" 
    <script src=
    <script src=
        h1 {
            color: green;
    $(document).ready(function() {
            addBackBtn: true,
        <!-- 1st Page -->
        <div data-role="page" id="page1">
            <strong>Toolbar addBackBtn option</strong>
            <div id="div" data-role="header">
                <h2>Header Toolbar</h2
            <a href="#page2">Go to Page2</a
        <!-- 2nd Page -->
        <div data-role="page" id="page2">
            <div id="divID2" data-role="header">
                <h2>Header Toolbar</h2
                GeeksforGeeks is a computer science 
                portal for geeks by geeks. Here you can
                find articles on various computer science
                topics like Data Structures, Algorithms
                and many more. 


jQuery Mobile Toolbar addBackBtn Option


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!