Returning false on link click jquery

后端 未结 4 1589
孤街浪徒
孤街浪徒 2021-01-24 22:33

I wish to have a link which opens popup when clicked however I wish it to open a page in a new window if the user doesn\'t have JS enabled.

The following doesn\'t seem t

4条回答
  •  醉酒成梦
    2021-01-24 23:04

    I think you just have the id selector wrong. Try changing $('tac-link') to $('#tac-link').

    Another approach:

    $('a[target="_blank"]').click(function(e) {
        window.open( this.href );
        e.preventDefault();
    });
    

提交回复
热议问题