+ 1

Why the error in the code.

I used for selection method in javascript and its showing an error. https://code.sololearn.com/W8sl0Mr606fz/?ref=app

5th Dec 2020, 6:42 PM
Chysomm🤩🇳🇬("inActive")
Chysomm🤩🇳🇬("inActive") - avatar
8 odpowiedzi
+ 2
Chysomm🤩🇳🇬("inActive") You need to get the value when you call the function.
5th Dec 2020, 6:47 PM
A͢J
A͢J - avatar
+ 2
Chysomm🤩🇳🇬("inActive") Yes but you are trying to get value before loading of html document. You must know that javascript loads before the html document.
5th Dec 2020, 6:56 PM
A͢J
A͢J - avatar
+ 1
AJ #Learn With Me 👨‍💻 okay, will do that.. and get back to you here
5th Dec 2020, 6:48 PM
Chysomm🤩🇳🇬("inActive")
Chysomm🤩🇳🇬("inActive") - avatar
+ 1
AJ #Learn With Me 👨‍💻 I called the function in the html document
5th Dec 2020, 6:54 PM
Chysomm🤩🇳🇬("inActive")
Chysomm🤩🇳🇬("inActive") - avatar
+ 1
Chysomm🤩🇳🇬("inActive") One more thing if you are calling your functions on any event then no need to write functions inside document.addEventListener("DOMContentLoaded
5th Dec 2020, 7:07 PM
A͢J
A͢J - avatar
+ 1
5th Dec 2020, 7:32 PM
Chysomm🤩🇳🇬("inActive")
Chysomm🤩🇳🇬("inActive") - avatar
0
AJ #Learn With Me 👨‍💻 Used the DOMContentLoaded event listener but still an error
5th Dec 2020, 7:08 PM
Chysomm🤩🇳🇬("inActive")
Chysomm🤩🇳🇬("inActive") - avatar