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 trialSean Lawrenz
15,886 PointsThe wording of the question is unclear. I get that I need to select the class external $('.external') and add the attr function to it $('.external').attr() And I understand that we are changing it to _blank, $('.external').attr(??,'_blank')
but I don't understand what "target" is.
3 Answers
Roy Penrod
19,810 PointsThe challenge is asking you to select all the anchor tags with the class "external" using only jQuery and then add an attribute called "target" with the value "_blank" to those anchor tags.
If you look at the HTML, the links look like this:
<li><a href="http://google.com" class="external">Google</a></li>
<li><a href="http://yahoo.com" class="external">Yahoo</a></li>
The challenge wants you to make them look like this:
<li><a href="http://google.com" class="external" target="_blank">Google</a></li>
<li><a href="http://yahoo.com" class="external" target="_blank">Yahoo</a></li>
Adding that target to the anchor tags causes the browser to open the link in a new tab rather than causing your browser to redirect to that link.
Jacob Mishkin
23,118 PointsI agree its poorly worded. What it wants you to do is target all links within the class external. So it should look like this:
$("a.external").attr('target' ,'_blank');
I hope this helps.
Sean Lawrenz
15,886 PointsGuys I feel like a complete fool. Forgot what the target markup does.
Thanks!
Roy Penrod
19,810 PointsNo reason to feel that way, Sean. It happens to all of us. Web development is complex with a lot of moving parts. No one can remember everything.
Jacob Mishkin
23,118 PointsJacob Mishkin
23,118 PointsIs it just the code challenge or is there something else?