how ot check if an element exist in the dom code example
Example 1: js check if dom element exists
var myElement = document.getElementById("myElementID");
if(!myElement){
//#myElementID element DOES NOT exist
}
if(myElement){
//#myElementID element DOES exists
}
Example 2: check if the element exists in javascript
var myEle = document.getElementById("myElement");
if(myEle){
var myEleValue= myEle.value;
}