Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Alec Gillanders
19,548 PointsWhy does this code not work? the community states it does??
We've got a select box that's used to navigate to a new page on the "change" event and record some analytics. We want two event handlers to fire, fix lines 14 and 15 so that both of the handlers trigger on "change" rather than just the last function assigned to onchange.
My code:
navigationSelect.addEventListener("change", navigateToValue); navigationSelect.addEventListener("change", sendAnalytics);
//Select select box
var navigationSelect = document.getElementById("nav");
//Navigate to URL when select box is changed
var navigateToValue = function() {
window.location = this.value;
}
//Send analytics data
var sendAnalytics = function() {
//Placeholder
}
navigationSelect.addEventListner("change", navigateToValue);
navigationSelect.addEventListner("change", sendAnalytics);
<!DOCTYPE html>
<html>
<body>
<select id="nav">
<option value="index.html">Home</option>
<option value="about.html">About</option>
</select>
<h1>Home</h1>
<script src="app.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<select id="nav">
<option value="index.html">Home</option>
<option value="about.html">About</option>
</select>
<h1>About</h1>
<script src="app.js"></script>
</body>
</html>
1 Answer

Jennifer Nordell
Treehouse TeacherIt would work, but you've managed to misspell "Listener". You've typed "Listner" in both rows. Try cleaning up the spelling, then try again. Here's what you need:
navigationSelect.addEventListener("change", navigateToValue);
navigationSelect.addEventListener("change", sendAnalytics);
Alec Gillanders
19,548 PointsAlec Gillanders
19,548 PointsSo simple, Thanks. what a stupid mistake.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherIt's absolutely not stupid! Every single one of us make typos, I promise you :)