New in jQuery here. I found several web pages that come close to what I'm trying to do, but not quite. In fact, I think it is actually assumed that it actually works, but he says:
[@href^="http://"]
not recognized (syntax error). Any help?
$(document).ready(function() {
$('a[@href^="http://"]').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).attr('target', '_blank');
});
Thanks.
source
share