How to check if id exists

If you want to check if an id exists with javascript

let element = document.getElementById("myId");
    if( element ){
        // the logic here
}

Leave a Reply