Search code examples
javascriptjquerypage-title

How to change browser page title dynamically to match it with <h1> title in javascript or jQuery?


I would like to change my page title dynamically so that it will match with the value of 'h1' heading element. Need to write a global javascript, which I can use throughout the application for every page. Kindly advice. Thanks in advance


Solution

  • document.title = $("h1").text();