I'm doing something wrong, and I can't find the error.
I'm stumped why I cannot change the innerHTML with this...
some text I want to change.<p>Click the button to get your coordinates.</p>
<button onclick="showPosition ()">Use My Location</button>
<!-- TODO: move this to an external script -->
<script>
var targetDiv = document.getElementsByClassName('targetDiv');
function showPosition () {
alert(targetDiv); // alerts the element fine
targetDiv.innerHTML = 'Foo'; // does not work
document.getElementsByClassName('targetDiv').innerHTML = 'foo'; // does not work either.
}
</script>