Add CSS cursor property when using “pointer-events: none”

后端 未结 7 1569
时光取名叫无心
时光取名叫无心 2020-11-30 06:52

I\'m trying to disable a specific link and apply cursor style but this CSS command cursor: text; won\'t effect. The cursor is always default. I\'m using latest

7条回答
  •  广开言路
    2020-11-30 07:34

    Remove pointer-events: none !important;. Disable the link using JavaScript:

    anchorElement.onclick = function(){
      return false;
    }
    

    If you don't know JavaScript anchorElement is the Node or Element itself. The most common way to get an Element is by using the HTML id attribute. Let's say we have:

    Text Here
    

    You code could be:

    document.getElementById('whatever').onclick = function(){
      return false;
    }
    

    There are a number other ways to get Nodes.

提交回复
热议问题