Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Replace/Change The Heading Text Inside <h1></h1>, Using Javascript?

How do I change/replace the text: "Hello" using javascript to say "Goodbye" instead?

<h1 class="titlearea win-type-ellipsis" id="title">
     <span class="pagetitle" >
            Hello
     </span>
</h1>
like image 851
noobprogrammer Avatar asked Dec 15 '22 07:12

noobprogrammer


1 Answers

document.getElementsByClassName("pagetitle")[0].innerHTML = "Goodbye";

Here is a working fiddle.

like image 154
Mithun Satheesh Avatar answered Apr 30 '23 04:04

Mithun Satheesh