[JQUERY SNIPPET] Open external links in new window
1 2 3 4 5 6 7 8 9 10 11 12 13 | $('a').each(function() { var a = new RegExp('/' + [removed].host + '/'); if(!a.test(this.href)) { $(this).click(function(event) { event.preventDefault(); event.stopPropagation(); window.open(this.href, '_blank'); }); } }); |