open-in-new-tab

by mrjordy

HTML

<div class="test">

<a href="https://www.w3schools.com">Visit W3Schools.com!</a>

</div>


<a href="https://www.google.com">Visit google.com!</a>

JavaScript

$(document).on('click', 'a', function(e){ 
    e.preventDefault(); 
    var url = $(this).attr('href'); 
    window.open(url, '_blank');
});