开发者

How to do: button click opens in this tab, or modifier-click opens in new tab, as with a normal link

This is what I have currently:

$('#dialog').dial开发者_StackOverflow中文版og({autoOpen: false, buttons: [{
    text: 'View Here', click: function() {
      $(this).dialog('close');
      window.location.hash = $(this).attr('tag');
    }
  }, {
    text: 'View Original', 
    click: function() {window.location = $(this).attr('href');}
  }
]});

If you click "View Original", the site loads directly. I want the user to be able to use the regular Command- or Ctrl-click to open the link in a new tab. How can I do this?


seems like this works,

$('#dialog').dialog({buttons: [{
    text: 'View Here', click: function() {
      $(this).dialog('close');
      window.location.hash = $(this).attr('tag');
    }
  }, {
    html: '<a href="http://google.com">View Original</a>', 
      click: function() {}
  }
]});

demo

well, only on Chrome.....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜