I'm trying to make a div have text put inside when clicked. But the code I use doesn't seem to work on Chrome. I'm just viewing the html document, not hosting it or anything. Anyone know the reason as to why this is happening?
file:///c%3A/Users/Brett/Documents/1_HTML/js_practice/js_practice.html
var bob = document.getElementById("bob");
bob.onclick = function() {
bob.innerHTML = "words";
};
#bob {
width: 200px;
height: 200px;
background-color: black;
color: white;
}
<body>
<div id="bob"></div>
</body>
P.S I can run the html document just fine, it's the code that's the problem