How to fix: Uncaught TypeError document.getElementbyId is not a function

If you have ever experienced the following error message using getElementById:

Uncaught TypeError document.getElementbyid is not a function

You will be glad to know that the fix is trivial. Pay attention to any lowercase letters in the method name. JavaScript is case-sensitive so the b and the start of every other word after get should be capitalized.

Correct use looks like the following:

document.getElementById("testUrl");

 

Gareth Dunne

Senior JavaScript Engineer and creator of JSdiaries. Passionate about the latest in web technologies and how it can provide value for my clients.