Disable Opening New Window or New Tab by holding down on a link

前端 未结 4 702

I want to thanks those who are currently reading this and for your time. Let\'s go straight to the topic!

I am currently trying to disable a feature where a user sho

4条回答
  •  有刺的猬
    2021-01-19 07:20

    You could bind an event handler to the desired link element and use jQuery's .preventDefault() method to cancel the link going anywhere. Your code would look something like this:

    $('a').click(function(event){
      event.preventDefault();
    });
    

提交回复
热议问题