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 JavaScript and the DOM (Retiring) Getting a Handle on the DOM Using CSS Queries to Select Page Elements

When using the exact same syntax you use in the video's i get a null returned! Do you know why?

document.querySelector('[title=label]') it returned the: null

The above is what i entered into the developer console.

Adam Beer
Adam Beer
11,314 Points

Please show your code.

3 Answers

Adam Beer
Adam Beer
11,314 Points

Try this Nathan,

document.getElementsByClassName("textDesign")

or

document.querySelector('[title="firstParagraph"]')

If it doesn't work please show your whole html/javascript code.

Martin Lecke
Martin Lecke
14,385 Points

Hi

You have missed one step in the video if you are tagging along the code-along.

On the 02:03 minute mark he adds the title="label" on the html tag. You dont have it in your html else you might have misspelled it. Check the video at 02.03

Same kind of issue for me. Here is my code in the html page: <p title="firstParagraph" class="textDesign"> Lorem ipsum dolor sit amet, consectetur adip... </p>

That is the result in the console:

document.querySelector('[title=firstParagraph]') null

Help, please!!