介紹
我們知道a標(biāo)簽是沒(méi)有disabled屬性的,那么我們?cè)撊绾螌?shí)現(xiàn)a標(biāo)簽按鈕的禁用呢?
方法一(推薦)
給a標(biāo)簽設(shè)置 “禁用” 屬性,如下代碼所示:
<a style="pointer-events:none" @click="xx()">
這樣 @click
點(diǎn)擊事件就不會(huì)觸發(fā)了。
方法二
使用 jquery:removerAttr() 或者 JS:removeAttribute() 移除 a 標(biāo)簽的 href 屬性。
方法三
使用 jquery:unbind() 或者 JS:removeEventListener() 移除點(diǎn)擊事件。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-792181.html
其他
如果想禁用a標(biāo)簽,如下,class調(diào)用disabled就可以了文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-792181.html
<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>
到了這里,關(guān)于css - 如何禁用 <a> 標(biāo)簽點(diǎn)擊,讓 <a> 標(biāo)簽實(shí)現(xiàn) disabled 禁用效果(鼠標(biāo)無(wú)法觸發(fā)點(diǎn)擊事件)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!