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

Border not showing up for me

Hi,

On this "Select an Element by ID" video, in my text editor and the Treehouse Workspace text editor, I can't get this code to work to show a border around the "headline" ID (though I checked multiple times and it seems to mirror what's shown in the video):

document.getElementById("headline").style.border = "solid 2 px red";

Thoughts?

Thanks!

Brendan

1 Answer

Steven Parker
Steven Parker
231,236 Points

There should not be a space between the width (2) and the unit (px):

document.getElementById("headline").style.border = "solid 2px red";

Wow, such a quick word back, thanks Steven--and your 2nd reply to one of my Q's, so doubly appreciate it!

I could've sworn i reviewed that code closely enough, but you were right on, can't believe i missed that! Many thanks again, cheers from NC,

Brendan