I've hit a roadblock where I keep getting warnings that the objects might be null. After searching online and on StackOverflow, I've tried numerous solutions with no luck. My goal is to insert the text "test" into the HTML elements using their IDs.
var cname = document.getElementById("chargername");
var cloc = document.getElementById("chargerlocation");
var ctype = document.getElementById("chargertype");
var cdesc = document.getElementById("chargerdescription");
var crating = document.getElementById("chargerrating");
function handleClick() {
cname.innerHTML = "test";
cloc.innerHTML = "test";
ctype.innerHTML = "test";
cdesc.innerHTML = "test";
crating.innerHTML = "test";
}
I'm facing this error: "TypeError: Cannot set properties of null (setting 'innerHTML')"
Any assistance would be greatly appreciated! Thanks! 😃