I’m trying to give links inside a specific paragraph a target. But I don’t get this to work..
$(document).ready(function(){
$('.link a[@href^=""]')
.attr("target", "_blank");
});
The links looks like this:
<p class="link"><a href="http://www.link.com">link</a></p>
The
@attrselector was dropped from jQuery plenty of versions ago (1.2 I think).To find the anchors with an
hrefattribute, use the Has Attribute Selector: