Link Button Target New Window

Here is the code for the new tab link. Make sure to replace the component number, and also replace .myClass with whatever class you decide to use for each button, and /sample/page with the relative link of the page you are opening.

Unfortunately you have to copy and paste for each button. Since you are creating a second link for the button, you’ll also have to disable the button link by setting it to link to itself in the dropdown window.

TB.render('component_XX',function(data){
        $(".myClass").click(function() {  
      window.open('/sample/page', '_blank');
    });
});

The attribute target="_blank" can only be applied to <a href links, not button links. So the only way to use a single script to target all of the buttons on a page would be to create custom HTML buttons in an HTML module and give them the same class. Then you could use:

$(document).ready(function() {
    
  $('a.myClass').click(function(){
    window.open(this.href);
    return false;
  });
});
1 Like