Getting type error in console:
Uncaught TypeError: Cannot read property 'addEventListener' of null
after clicking the "Click" button. How can I fix this?
document.getElementById("btn").addEventListener("click", function(){
document.getElementById("para").innerHTML("This is text");
});
<ul id="myList">
<li>item1</li>
<li>item 2</li>
</ul>
<button id="btn">Click </button>
<form name="myForm">
Select output mode: <input type="radio" name="output" value="printer" checked /> Printer
<input type="radio" name="output" value="scanner" /> Scanner
</form>
` tag, is best unless you have a reason to do something else, and it would correct the first problem above. The second problem is that `innerHTML` isn't a function, it's a property.
– T.J. Crowder May 16 '18 at 06:47