+ 6

Undefined value?

Please tell me qhats wrong with this code https://code.sololearn.com/Ww05laCeNLgu/?ref=app

24th Nov 2018, 4:31 AM
Jingga Sona
Jingga Sona - avatar
5 Antworten
+ 5
Change line 36 to: alert(document.getElementsByClassName("nomove")[0].value) because you get all the elements with the class name nomove, it returns an array not a single element.
24th Nov 2018, 4:34 AM
Rowsej
Rowsej - avatar
+ 5
Oh yes, i always forget to do that, thanks for reminding Zephyr Koo
24th Nov 2018, 5:33 AM
Jingga Sona
Jingga Sona - avatar
+ 4
Jingga Sona 🐺 [ON PROJECT] Seeing your problem was already resolved it would be great if you can mark the answer that you find useful to encourage the community to help each other out. 😉
24th Nov 2018, 5:31 AM
Zephyr Koo
Zephyr Koo - avatar
+ 3
Thanks @rowsej, i learn something now!
24th Nov 2018, 4:36 AM
Jingga Sona
Jingga Sona - avatar