0
erorr cardId is not defined
why cardId is defined what is wrong with my script help me to solve this erorr https://code.sololearn.com/WwPdIuRf9qB5/?ref=app
4 ответов
+ 1
when you set the wrapping to "onLoad" the functions you define are only defined inside that block, and cannot be accessed by outside event handlers.
to fix this, change:
function cardHide() {......}
to
window.cardHide = function() {....}
+ 1
ok thanks i just found out about this thanks Mohamed ELomari
0
remove the parentheses from cardHide inside the addEventListener method
0
Mohamed ELomari ok thanks for success oh yes i want to ask again if i give event click in attribute so onclick = cardHide () why always erorr and the function named cardHide is defined why it can happen like this
https://code.sololearn.com/WwPdIuRf9qB5/?ref=app