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 trialnathan goel
7,410 PointsI try to use document.querySelector with a title attribute, it returns null in console. I don't see what I missed there.
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!!
2 Answers
ARCHIT RANA
Full Stack JavaScript Techdegree Graduate 27,853 PointsI was getting the same error 'the value null for the query selector'.
Then I realized I had saved the file app.js but forgot to refresh the browser for the changes to reflect in the DOM.
Jonathan Grieve
Treehouse Moderator 91,253 PointsIt looks like your CSS query in your method isn't quite right.
In the absence of a link I can only make a best guess as to the exact selector you need but try passing the following in your querySelector method.
document.querySelector('[title="firstParagraph"]')
ja5on
10,338 Pointsja5on
10,338 PointsThank You! I was stuck too then I read your answer, Oh the simple stuff still gets me haha