Fix Javascript error .. Console Output - Uncaught TypeError: Cannot read property 'remove' of undefined | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Fix Javascript error .. Console Output - Uncaught TypeError: Cannot read property 'remove' of undefined

I have created a modal window wherein i can open two modal windows one -by-one and it has functionality to close them similarly one -by-one ( closing second window keeps the earlier window still active ) My JavaScript code has some issue also mentioned in the question title. Please someone suggest a fix Whole codes + Output present here - https://jsbin.com/kasanaxuta/edit?output

30th Aug 2019, 2:28 PM
Badal Singh
1 Answer
0
line 39: modals[index].classList.remove("modal-content-active"); You got an error here. I think it happens, because You wrote a selector ("modal-content-active") incorrect. Try changing it to proper name.
4th Mar 2020, 12:02 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar