DOM

Javascript & DOM Order: getElementById() is 'null'

Just a gentle reminder: looking to modify an element on the page using JavaScript's getElement or querySelector? Make sure your script appears further down the DOM than the element you're trying to change!

I have a feeling this a pretty basic concept in JavaScript, but for those of us who come to the language with a "fake it until you make it" kind of mentality, sometimes you need a simple reminder. Today isn't the first time I've hit this wall. I target a page element to affect some sort of change and JavaScript seems to bug out. Even though the element obviously exists--there's no mistake in the element ID--the console reports an error all the same: i.e., document.getElementById("some-target") is 'null'.