Need to check an ID whether is available in the DOM, before using the document.getElementById.
i.e. We have find() in jquery. Need to know the same in javascript
Please find the below example.
since dsp-store-name is not available in the DOM, its throwing the below exception in the console.
document.getElementById("dsp-store-name").innerHTML
VM655:1 Uncaught TypeError: Cannot read property 'innerHTML' of null at :1:43 (anonymous) @ VM655:1