Pete Freitag Pete Freitag

Removing Back Button on jQuery Mobile

Published on January 28, 2011
By Pete Freitag
web

When building native apps with jQuery Mobile I often find that the back button is not needed in the header toolbar. There is a quick and easy way to disable it by adding data-backbtn="false" to your header:

<div data-role="header" data-backbtn="false">
  <h1>Mileage Pad</h1>
</div>


jquerymobile

Removing Back Button on jQuery Mobile was first published on January 28, 2011.


Discuss / Follow me on Twitter ↯

Comments

Ahh! Thank you! I was kicking around this issue just yesterday. I thought there must be an easy way to do it. You have saved me some painful searching and a lot of trial and error!

Many thanks!
by Steve on 01/28/2011 at 12:57:33 PM UTC
Odd... its not working for me. But I change the attribute to this and it did work:
data-nobackbtn="true"
by Steve on 01/28/2011 at 1:09:09 PM UTC
Steve what version of jQuery Mobile are you using Alpha 2 or Alpha3 (from git repo)
by Pete Freitag on 01/28/2011 at 1:14:37 PM UTC
Alpha 2... that was the latest I saw online earlier this week. I'll take another look... maybe I missed a newer version.
by Steve on 01/28/2011 at 1:27:45 PM UTC
Alpha 3 has not been released yet but you can download it from their git repository.
by Pete Freitag on 01/28/2011 at 1:30:47 PM UTC
Right I probably shouldn't call it alpha 3 since it has not been released yet, but if you download the latest source from git that's what I'm talking about.
by Pete Freitag on 01/28/2011 at 1:31:52 PM UTC
I only see a2, even on Github.
by Steve on 01/28/2011 at 1:36:28 PM UTC
I'm working my way through the docs in preparation for my SOTR preso. One thing I wish they would do is create a list of _all_ the data attributes along with where they can be used and what they do. I may end up doing that myself.
by Raymond Camden on 02/12/2011 at 10:09:44 AM UTC
Yeah I agree, I always prefer a straight up reference over docs embedded in prose.
by Pete Freitag on 02/14/2011 at 9:58:30 AM UTC
data-nobackbtn="true" attribute works for me with latest JQuery mobile 1.0a4.1
by Sundar on 06/15/2011 at 4:17:06 PM UTC
That's a sensible answer to a chgnielalng question
by Kacy on 10/19/2016 at 12:02:05 PM UTC