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 Working with jQuery Collections Changing Element Properties

Antonio De Rose
Antonio De Rose
20,885 Points

same code, does not open in a new window

const $secureLinks = $('a[href^="https://"');

$secureLinks.attr('target','_blank')

Saqib Ishfaq
Saqib Ishfaq
13,912 Points

just to add you forgot closing square bracket there.... const $secureLinks = $('a[href^="https://"]'); and a semi colon to end the 2nd statement.... $secureLinks.attr('target','_blank');

it might work without these but just incase:)

2 Answers

Antonio De Rose
Antonio De Rose
20,885 Points

it is working now, thanks anyway., what I did was CTRL + F5

Steven Parker
Steven Parker
231,261 Points

This code seems to be OK, but what's the HTML look like that it works on?