如何禁用HTML链接 [英] How to disable HTML links

查看:158
本文介绍了如何禁用HTML链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接按钮在< td> ,我必须禁用。这在IE上工作,但不工作在Firefox和Chrome。
结构是在< td> 内的链接。我无法在< td> (如div / span)中添加任何容器



但不能在Firefox上使用(使用1.4.2 js):

  $(td).children ){
$(this).attr('disabled','disabled');
});


$(td).children()。attr('disabled','disabled');

$(td).children()。attr('disabled',true);

$(td).children()。attr('disabled','true');

注意 - 由于动态注册锚标记,所以无法注销锚定标记的点击函数。

解决方案

在css中找到解决方法。

  td.disabledAnchor a {
pointer-events:none!important;
cursor:default;
color:Gray;
}

在应用于锚定标记时,css上方将禁用点击事件。 p>

有关详情,请链接


I have a link button inside a <td> which I have to disable. This works on IE but not working in Firefox and Chrome. Structure is - Link inside a <td>. I cannot add any container in the <td> (like div/span)

I tried all the following but not working on Firefox (using 1.4.2 js):

$(td).children().each(function () {
        $(this).attr('disabled', 'disabled');
  });


  $(td).children().attr('disabled', 'disabled');

  $(td).children().attr('disabled', true);

  $(td).children().attr('disabled', 'true');

Note - I cannot de-register the click function for the anchor tag as it is registered dynamically. AND I HAVE TO SHOW THE LINK IN DISABLED MODE.

解决方案

Got the fix in css.

td.disabledAnchor a{
       pointer-events: none !important;
       cursor: default;
       color:Gray;
}

Above css when applied to the anchor tag will disable the click event.

For details checkout this link

这篇关于如何禁用HTML链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆