0

I am using include method to include the menu page on every pages, code below:

<!--#include virtual="include/menu/Menu.html"

This Menu.html page has a static title <Title>ABC</Title>. Note that the Title for current viewing page does not show its Title, but only show the Title for the included Menu.html page, which is "ABC".

Is there a way to change the <Title><Title> for the menu page (not the Title on the current viewing page) by using JavaScript, jQuery, or any trick you can think of?

halfer
  • 19,824
  • 17
  • 99
  • 186
Milacay
  • 1,407
  • 7
  • 32
  • 56
  • 3
    I expect so. Using jQuery, (not tested) something like `$('title').text('New title')`. – halfer May 07 '14 at 21:13
  • 1
    I just used this technique recently to modify the contents of a ` – halfer May 07 '14 at 21:16

2 Answers2

2

You can also just use plain javascript:

document.title = "The new title";
1andsock
  • 1,557
  • 10
  • 15
1

You can do this:

$('title').text('New title');

There is another jQuery method called html() but that's only suitable when adding content that must be understood as tags. Since titles cannot contain HTML, text() is appropriate.

halfer
  • 19,824
  • 17
  • 99
  • 186