Evite o OnClick Event JavaScript

// Using CSS (prefered)
#foo {
    pointer-events: none;
}

//Using JS
const clickable = true;

document.getElementById("foo").onclick = () => {
    if (clickable) {
        //...your code
    }
}
Q_Q