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 trialpeterson st gourdain
931 Pointswhy cant i add my alert
why cant i add my alert
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="scripts.js"></script>
<script>
alert("warning");
</script>
</body>
</html>
2 Answers
Steven Parker
231,271 PointsThis is better, the code is now inside the body element. But you still have a line with an extra set of script tags with a src attribute that are not part of this challenge. That line should be removed.
Martin Zarate
10,723 Pointsfunction theAlert() {
alert("Warning!");
}
theAlert();
I believe this is a duplicated question.
Steven Parker
231,271 PointsBut creating and calling a function is not part of this challenge.
Martin Zarate
10,723 PointsI believe we must be looking at different questions Steven, the one I see has this question: Challenge Task 2 of 2 - Inside the script tags, write a function that will open an alert dialog with the message 'Warning!' - that is a copy-and-paste from the challenge page. Also, I tried my solution before posting it, it works correctly. Cheers.
Steven Parker
231,271 PointsYes, I can see that it would indeed pass the challenge, but it's not needed for the challenge or related to the cause of the issue. The "function that will open an alert dialog" that the instructions are asking you to use is simply the alert itself.
peterson st gourdain
931 Pointspeterson st gourdain
931 Pointsthanks I got it