css - How to disable the <a> label click, let the <a> label realize the disabled effect (the mouse cannot trigger the click event)

introduce

We know that the a tag has no disabled attribute, so how do we disable the a tag button?

Method 1 (recommended)

Set the "disabled" attribute to the a tag, as shown in the following code:

<a style="pointer-events:none" @click="xx()">

This way @clickthe click event will not fire.

Method Two

Use jquery: removeAttr() or JS: removeAttribute() to remove the href attribute of the a tag.

method three

Use jquery: unbind() or JS: removeEventListener() to remove the click event.

other

If you want to disable the a tag, as follows, the class can call disabled

<style>
   a.disabled {
      
      
        style="color:rgb(98 189 255)">pointer-events: none;
        style="color:rgb(255 211 0)">filter: alpha(style="color:rgb(253 97 106)">opacity=50); /*IE滤镜,透明度50%*/
        style="color:rgb(98 189 255)">-moz-style="color:rgb(253 97 106)">opacity: 0.5; /*Firefox私有,透明度50%*/
        style="color:rgb(253 97 106)">opacity: 0.5; /*其他,透明度50%*/
    }
</style>

Guess you like

Origin blog.csdn.net/weixin_50545213/article/details/128903708