0

Inside the script tag there was a error: Uncaught TypeError: correct.addEventListner is not a function at HTMLDocument. (index.html:14)

Please help me fix it here's the code:

var correct = document.querySelector('.correct');
correct.addEventListner('click', function () {
    correct.style.backgroundColor('green');
    document.querySelector('#feed1').innerHTML = 'Correct!';
    });
3
  • could you add some of your html for better understanding – Vsjain May 5 at 16:26
  • check spelling of the method name . – DinoCoderSaurus May 5 at 20:27
  • Thanks, and I also found that on line three it should be #green – Agnij Moitra May 6 at 5:09
0
var correct = document.querySelector('.correct');
    correct.addEventListener('click', function () { // I had misspelled Listener
        correct.style.backgroundColor = 'green';
        document.querySelector('#feed1').innerHTML = 'Correct!'; // It should have been #feed1
        });
2
  • You should explain what was incorrect, instead of just giving code – Vsjain May 6 at 6:48
  • added now, in form of comments – Agnij Moitra May 7 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .