I want to change the title of HTML file using Javascript that the title will be like,
(the h1 tag of the document)+"Text "
(the h1 tag of the document)+"Text "
<!DOCTYPE HTML> <html> <head> <script type="text/javascript"> function fun() { document.title = "Text - " + document.getElementById("MyID").innerHTML; } </script> <title></title> <meta charset="utf-8" /> </head> <body onload="fun()"> <div id="fb-root"></div> <div id="wrapper"> <section id="mainsection"> <article title="Download PC games for free"> <header> <h1 id="MyID">Testing</h1> </header> </article> </section> </body> </html>
Comment