Learn Create Your Own Split Screen

Next Page

If you've done any reading about Javascript and HTML, you may have seen lots of use of getElementById.

Intsead of this:

MyAnswer.innerHTML = "Hello + MyInput.value;
You will frequently see things like this:
document.getElementById("MyAnswer").innerHTML = "Hello + document.getElementById("MyInput").value;

What's it all about and why aren't we teaching it that way in S2JS ?

The reality is, if you're a professional web developer writing an app that will be used over many years in a wide range of environments, then using getElementById is the correct approach.

Not using it is a bit of a shortcut, but for our purposes makes the code a lot clearer.

So even though it's not best practice, it makes things much easier in the early stages.