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.

JavaScript Callback Functions in JavaScript Callbacks and the DOM Callbacks with DOM Elements

Jaime Sanchez
Jaime Sanchez
Full Stack JavaScript Techdegree Student 10,763 Points

callbacks with dom elements challenge task 1 help?

Im stuck on this please help.

const btn1 = document.getElementById("button1");
const btn2 = document.getElementById("button2");
const btn3 = document.getElementById("button3");

const spinElement = event => {
  //Applies spinning animation to button element
  event.target.className = "spin";

btn1.addEventListner('click', spinElement);
btn2.addEventListner('click', spinElement);
btn3.addEventListner('click', spinElement);
<!DOCTYPE html>
<html lang="en">
        <link rel='stylesheet' href='styles.css'>
        <section >
            <button id='button1'>Button 1</button>
            <button id='button2'>Button 2</button>
            <button id='button3'>Button 3</button>
        <script src='app.js'></script>

1 Answer

Steven Parker
Steven Parker
215,357 Points

You're close, but you have a spelling issue. You have "addEventListner" (missing an "e") instead of "addEventListener".