Error with addEventListener | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Error with addEventListener

the function of my addEventListener run alone ???? btnUn.addEventListener('click', fctGood (error, good, q, i, rUn, rDeux, rTrois, rQuatre, rGood) ); I think we should remove the paranthèse but i need then to keep the variable ??? Could you help me ?

2nd Mar 2019, 9:57 AM
Alexis
Alexis - avatar
1 Answer
+ 7
Use bind function to bind the parameters btnUn.addEventListener('click', fctGood.bind(null, error, good, q, i, rUn, rDeux, rTrois, rQuatre, rGood) ); PS. Please set the proper relavent title of this question
2nd Mar 2019, 10:11 AM
Calviղ
Calviղ - avatar