Disable mouse click on links or divs

Hi guys! In this tutorial I will show you an easy way about how to disable mouse click on links, menu or divs.

If you want to disable all links in a menu or div, you can use the css element pointer-events.

You can add pointer-events: none; through javascript:

document.getElementById("div").style.pointerEvents = "none";

or through jQuery:

$("div ").css("pointerEvents","none");

To re-enable, use:


document.getElementById("div").style.pointerEvents = "auto";

or

$("div ").css("pointerEvents","auto");









Leave a Comment