jQuery: go to URL with target=“_blank”

后端 未结 7 1944
悲哀的现实
悲哀的现实 2020-12-04 15:12

I am using this bit of jQuery code to get href of the link:

var url = $(this).attr(\'href\');

-- and this bit of code to go to that href:

相关标签:
7条回答
  • 2020-12-04 16:05

    Question: How can I open the href in the new window or tab with jQuery?

    var url = $(this).attr('href').attr('target','_blank');
    
    0 讨论(0)
提交回复
热议问题