Open In App
Related Articles

jQuery Mobile Toolbar addBackBtn Option

Improve Article
Save Article
Like Article

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


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 28 Dec, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials