How to disable HTML links

后端 未结 14 1355
刺人心
刺人心 2020-11-22 13:00

I have a link button inside a which I have to disable. This works on IE but not working in Firefox and Chrome. Structure is - Link inside a <

相关标签:
14条回答
  • 2020-11-22 13:40

    Just add a css property:

    <style>   
    a {
     pointer-events: none;
    }
    </style>
    

    Doing so you can disable the anchor tag.

    0 讨论(0)
  • 2020-11-22 13:40

    I would do something like

    $('td').find('a').each(function(){
     $(this).addClass('disabled-link');
    });
    
    $('.disabled-link').on('click', false);
    

    something like this should work. You add a class for links you want to have disabled and then you return false when someone click them. To enable them just remove the class.

    0 讨论(0)
提交回复
热议问题