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 trialJason Williamson
6,426 PointsSelf-destructing message solution not working
I have typed in the exact code as provided by the instructor and I am not getting any of the appropriate responses
Dane Parchment
Treehouse Moderator 11,077 PointsCan you please provide the code that you yourself have written? It's still possible you accidentally added or removed something that is causing issues.
1 Answer
Vaidehi S
5,731 PointsHi,
I have the same code and when I click the preview it open the webpage with the h1 tag but the alerts and other functions are not working for me. Please see the below code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Basics – Challenge</title>
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<main>
<h1>Welcome to the Webpage!!</h1>
</main>
<script src="js/script.js"></script>
</body>
</html>
alert("Warning! This message will self-destruct in"); alert("3..."); alert("2..."); alert("1..."); document.querySelector("h1").textContent = "🔥BOOM!🔥"; console.log("Message destroyed!");
Please let me know what is wrong with this. Thanks
Vaidehi S
5,731 PointsMessage in the console.log is not displaying. I have saved the file as well.
Christian Darlington
1,950 PointsChristian Darlington
1,950 PointsSame thing happening to me