0

I have just started programming and I am trying to do a quiz, but function is not working. Problem reads as follows and its not reading function handlefirst()

scripts.js:22 Uncaught TypeError: Failed to execute 'addEventListener' on 'EventTarget': The callback provided as parameter 2 is not an object.

buttonFq.addEventListener('click', handleFirst ())
    
const RespuestaIncorrecta = 'Tu respuesta es incorrecta'

const curiosityFirstQcontent = document.querySelector.innerTex("#curiosity-first-q");


function handleFirst() {
    if(firstqq === "Stallone"){
        return curiosityFirstQcontent = 'Correct'
    }
    else{
        return 'Not correct'
    }
}
icecub
  • 8,615
  • 6
  • 41
  • 70
Isabel GM
  • 61
  • 7
  • Try changing `buttonFq.addEventListener('click', handleFirst ())` to `buttonFq.addEventListener('click', handleFirst)` – icecub Oct 25 '20 at 13:02

1 Answers1

0

The second argument you are passing is wrong. It should be

buttonFq.addEventListener('click', handleFirst)

And also there is a typo instead of innerText in your code it is innerTex.Please change this too

  • Thanks a lot, you are absolutely correct! Thank you so much, its the simple things that are hard to see at first sight! – Isabel GM Oct 26 '20 at 18:02