JSFiddle - React, Tailwind, and code Playground

by John Doe

HTML

<a class="noExt" href="https://www.jsfiddle.net">Foo</a>
<a href="https://www.jsfiddle.net">jsfid</a>
<a href="javascript:void(0);">Baz</a>
<a href="#">Baz</a>

JavaScript

$( 'div' ).not( ".noExt" );

$('a').each(function(i, el) { 
	
  
	var href = $(el).attr('href');
  if (href != '#' && href != 'javascript:void(0);') {
  
    		var a = new RegExp('/' + window.location.host + '/');
    
    			$(this).click(function(event) {
						event.preventDefault();
						event.stopPropagation();
						window.open(this.href, '_blank');
					});
				}
        
     console.log(el);
    }   
    
    
);