how to disable a onclick element code example
Example 1: disable div click
// To disable:
document.getElementById('id').style.pointerEvents = 'none';
// To re-enable:
document.getElementById('id').style.pointerEvents = 'auto';
// Use '' if you want to allow CSS rules to set the value
Example 2: disable onclick
pointer-events: none;
cursor: default;