I am not very familiar with this
, and therefore have likely used it wrong. It may also be the fact that I don't have an advanced knowledge of JavaScript or jQuery in any circumstance. I have regex that–to my knowledge–should catch all Wikia links, and exclude them from my element selection.
My main issue is that it seems to be catching all a
elements, when I only want those which correspond with my if
statement. I have my current code below.
$('a').each(function() { if($(this).attr('href') != /(((http|https)?:\/\/)?(((\w*\.)?\w*\.)?wikia\.com))?(\/wiki\/)?(\w*(:\w+)?)?(\?w+=.+)?/ ) { $(this).attr('target', '_blank'); } });
Any help is greatly appreciated!