How can I open a link in a new window?

后端 未结 10 1112
不知归路
不知归路 2020-11-30 19:21

I have a click handler for a specific link, inside that I want to do something similar to the following:

window.location = url

I need this

10条回答
  •  半阙折子戏
    2020-11-30 19:41

    Here's how to force the target inside a click handler:

    $('a#link_id').click(function() {
        $(this).attr('target', '_blank');
    });
    

提交回复
热议问题