I’ve got this piece of code, but i wanna fix it because the if statement if it’s true it’s empty… any ideas of how i can make it false always?
using ! inside the if it’s not working
var $link = $(this).attr("href");
if ($link.match(/^(?:.*?\.)?(domain)\.net(?:\/.*)?$/)) {
}else {
$(this).attr("href",'http://links.domain.net/?url='+$link);
}
This it’s in jquery in this function
/* change_links */
(function($) {
$.fn.change_links = function() {
$('.post a:not([href^=mailto])').each(function() {
var $link = $(this).attr("href");
if ($link.match(/^(?:.*?\.)?(taringacs)\.net(?:\/.*)?$/)) {
}else {
$(this).attr("href",'http://links.taringacs.net/?url='+$link);
}
});
}
})(jQuery);
thanks in advance
Use RegExp.test