开发者

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

开发者 https://www.devze.com 2023-02-06 21:48 出处:网络
This is what I have currently: $(\'#dialog\').dial开发者_StackOverflow中文版og({autoOpen: false, buttons: [{

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

精彩评论

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