$('.content a[href^=http]').each(function(){ $(this).not('[href*="'+location.hostname+'"]').append(' [External Link]'); }); $('.dummylink').click(function() { return false; });
.content { width:300px; margin:auto; }
<div class="content"> a href="dummypage"<br> <a href="dummypage" class="dummylink">Lorem ipsum</a><br> a href="http://google.com/"<br> <a href="http://google.com/" class="dummylink">Duis aute</a> </div>