How to change the web page title using jquery?

How to change the web page title using jquery?

Need to set the value for title attribute of document element in the web page.

Below is the sample code to change the web page title.


 <!DOCTYPE html>
 <html>
 <head>
     <title>Page Title </title>
     <script src="https://code.jquery.com/jquery-1.9.1.min.js"> </script>
     <script type="text/javascript">
        $(function () {
         
            $(document).attr("title", "Custom Page Title");
        });
     </script>

 </head>
 <body>
     <p>Example page to set page title using jquery code! </p>
 </body>
 </html>

Output:

Web page title is updated as Custom Page Title instead of Page Title which was initialized.



Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^