window.oncontextmenu = function(e){
// your code that will add html with your custom menu
e.preventDefault();
}
window.oncontextmenu = null
const element = document.getElementById('someId')
element.oncontextmenu = null // || or function (e) { /*code*/ e.preventDefault(); } соответсвенно