I created a basic page in my drupal 7 site.

On that page I have some jquery tabs. When I click on tab1 its content displays and hides the contents of other tabs, and when I click on tab2 its content displays and hide other contents and so on.

So I want to change the title of the page in the content area according to the tab selected. If tab1 selected and its content are showing then title of the page in content area should be changed according to the tab content(for example Tab1) and similarly for others.

Is this possible?

I have tried drupal_set_title("Tab1") but it does not change the title of the page. and also it will not help me because it will change the title once and I want dynamic based on the tab selected.

2 Answers 2


You need to add an onclick() event handler for all tabs.
Assuming UL LI layout http://jsfiddle.net/k7Gkm/

  • Sorry I did not mention it in my question but I am talking about the page title which is in the content area. Not about the page title of the browser(<title></title>).
    – Ahmad
    Jul 9, 2012 at 6:04
  • Ok i have edited my answer. Added a jsfiddle link, update it with your HTML structure.
    – GoodSp33d
    Jul 9, 2012 at 6:41
  • I had my own jquery. I get the idea from your jquery and modified my jquery code according to my needs and I solved my problem. Thanks @kantu :)
    – Ahmad
    Jul 9, 2012 at 7:28

If you are using jQuery UI Tabs:

$("#tabs").bind('tabsselect', function(event, ui) {
  document.title = $(ui.tab).text();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.