How to make an anchor tag refer to nothing?

后端 未结 18 1667
一向
一向 2020-12-12 10:28

I use jQuery, I need to make some anchor tags perform no action.

I usually write it like this:

link

H

18条回答
  •  伪装坚强ぢ
    2020-12-12 10:41

    Make sure all your links that you want to stop have href="#!" (or anything you want, really), and then use this:

    jq('body').on('click.stop_link', 'a[href="#!"]',
    function(event) {
         event.preventDefault();
    });
    

提交回复
热议问题