I would like to change text in P or other tag in HTML with Java Script
I tried to many different ways. However, any of those didn't work well.
Console says.
Uncaught TypeError: Cannot set property 'textContent' of null
<script>
//1 document.getElementById("stackoverflow").textContent="newtext";
//2 document.getElementById("stackoverflow").value ="newtext";
//3 document.getElementById("stackoverflow").innerHTML ="newtext";
<script>
<div class="row">
<p id="stackoverflow">I wanna change this text</p>
</div>
` don't have a `.value` - so ... 1 down, 2 to go - if you want text, and NO html, use `.textContent` - if you want to include html, use `.innerHTML` - Amazing!!! what to use is in the name!!!!
– Bravo Aug 13 '21 at 05:44