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 trialAyub Muhammad
Courses Plus Student 4,345 PointsCan't make the heading red
const myHeading = document.getElementById('myHeading');
myHeading.addEventListener('click', () => {
myHeading.style.color = 'red';
});
what is wrong with my code. I can't get the h1 heading to become red!
2 Answers
Clayton Perszyk
Treehouse Moderator 48,850 PointsMy guess is that myHeading n your HTML is not an id or is spelled differently. Could you post your html code as well?
shashi7
11,034 PointsHi, Your script tag is misspelt.
<sciprt src="app.js"></sciprt>
Should be
<script src="app.js"></script>
It should work now.
Ayub Muhammad
Courses Plus Student 4,345 PointsThank you very much!!!!
Ayub Muhammad
Courses Plus Student 4,345 PointsAyub Muhammad
Courses Plus Student 4,345 Pointssure here it is: <!DOCTYPE html> <html> <head> <title>JavaScript and the DOM</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <h1 id="myHeading">JavaScript and the DOM</h1> <p>Making a web page interactive</p> <sciprt src="app.js"></sciprt> </body> </html>