Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialnicolaslemaire
12,806 PointsAny help on that one?
Hi everyone,
can't get this one done... I've tried to get some advice in reading the .attr rule on api.jquery.com but I can't figure it out. Can you tell me what is wrong please? I've tried:
.attr("target = _blank"), .attr("target" = "_blank"), .attr("target", "_blank") and so forth but it doesn't run properly. Thanks in advance! Bye.
3 Answers
William Li
Courses Plus Student 26,868 PointsHi there.
Using jQuery only, add to all links with the class "external", the target attribute with the value of "_blank".
You got half of it right, but don't forget this part add to all links with the class "external".
$('.external').attr('target', '_blank');
Like such. Hope it helps
nicolaslemaire
12,806 PointsHi William, thanks a lot. I must say... I'm surprised because "to all LINKS" so I thought it was ".external a" not only ".external", thanks! :)
David Klein
628 PointsThank you, this was actually very simple