Use docoument querySelector in Javascript tutorial 1
Use docoument querySelector in Javascript tutorial
I want to change content of Heading tag or any tag. How to do it with the help of JavaScript dynamically.
Lets first create our Heading using h1 tag
<h1>This is my H1 </h1>
Now use query selector to select the tag and save it in variable on the left side.
var myHeading = document.querySelector('h1')
We have “textContent” in JavaScript to change the content of the heading tag.
myHeading.textContent = 'Be Kind To EveryOne';