javascript get element by id value undefined code example Example: javascript get element by id var element = document.getElementById("YourElementId");