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 trial

JavaScript jQuery Basics (2014) Creating a Simple Lightbox Adding New Attribute Values with attr()

Carlos Enrique Castañeda Gutiérrez
Carlos Enrique Castañeda Gutiérrez
13,886 Points

Error in code challenge, it says is empty but is not

Hello:

I think there is a bug on this code challenge:

here is my code:

var target = "_blank"; $(".external a").attr("target",target);

but a Boomer error message says : target must be "_blank" not " ";

Is a bug, right? or I'm so blind I can't see my mistake?

Thanks

2 Answers

You are being asked to target and anchor tag with a class of "external", but you are writing your jQuery call as if you are trying to target an anchor tag inside of an element with a class of "external".

in your code:

var target = "_blank"; $(".external a").attr("target",target);

you need to change

$(".external a")

to just be

$(".external")

so that it targets the elements with a class of "external", and this should solve your issue.

Happy coding!

Carlos Enrique Castañeda Gutiérrez
Carlos Enrique Castañeda Gutiérrez
13,886 Points

Jesuschrist !! , how I didn't see that.

Thanks very much!, now I can complete the course :P