This is very common that we get requirement or scope to disable some specific div(s) or section because of security reasons.

Simple solution: Add

oncontextmenu="return false;"

Example

<div oncontextmenu="return false;">Disabled right click contents</div>

Another Solution, add below javascript.

 document.getElementById("divId").addEventListener("contextmenu ", function(){
       console.log("Right Click");
       return false;
    });

Regards

Leave a Reply

Your email address will not be published. Required fields are marked *