fixed js logic for null element check. document.getElementById returns
null if element is not found and not undefined.