Take the 2-minute tour ×

I have a jQuery Mobile app that's just like the dynamic page sample from the jQuery Mobile documentation http://jquerymobile.com/test/docs/pages/dynamic-samples/sample-reuse-page.html.

Everything works fine, but just as in the example I can't get the page titles to change accordingly to the requested page. On the basis of the example: When you click the category Colors in the Categories section, the new page has the title Colors, but when you go back and then select Vehicles, the page title is still Colors. How can I fix this?

I tried $page.attr('data-title', category.name) in the showCategory function but it won't work. Any ideas?

share|improve this question
the jquery example page works fine for me, both in chrome and my android phone. –  Nelson Sep 25 '12 at 13:03
Seriously? I always get i.imgur.com/aBvNr.jpg, the same for firefox (both mobile and desktop) –  ericS Sep 25 '12 at 13:41
Ah you are right, the tabs on my chrome were so stretched I didn't noticed.. ugh. –  Nelson Sep 25 '12 at 13:47

2 Answers 2

I don't see the behaviour you're describing in the example. However, to change the title wouldn't this do the job?

document.title = category.name;
share|improve this answer

You can also use something like this -


share|improve this answer
jquery mobile has a built in page title system ... original post mentions the 'data-title' attribute. So although your answer is correct from an html point of view, it is not correct from a jqm pov. Doing this on a jqm site would basically be a conflict. –  dsdsdsdsd May 11 '13 at 22:28
You can try something like this - $("#div-id").data("title", "New Page title"); That's worked for me. Thanks. –  Himel Khan Aug 7 '13 at 17:26

Your Answer


