Need help with JavaScript. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Need help with JavaScript.

So this is my code at present: https://code.sololearn.com/WEE9mZOZctgh/?ref=app Is anyone able to answer me why the checkarray (line 34) is returning a zero length? I've tried switching the querySelectorAll command with getElementsByClassName with no success. This is my second day on this issue now and I've googled/tried everything I can think of. Thanks in advance for your help. As an aside: can anyone using SoloLearn on an iPad verify if they get any alert at all? iPhone: alert shows, iPad: nothing.

21st Apr 2018, 10:49 AM
Russ
Russ - avatar
6 Answers
+ 1
The answer is simple... You set wrong attribute.... class attr not exists in js element when you creating a new attribute for that object... Set the "className" attribute or if you want set a list of class for element "classList"
21st Apr 2018, 10:59 AM
KrOW
KrOW - avatar
+ 2
Great, thanks. It should have been span2.className = ...
21st Apr 2018, 11:01 AM
Russ
Russ - avatar
+ 2
I post a list of useful resources for learnand reference: https://code.sololearn.com/WaVusr8J1KvK/?ref=app
21st Apr 2018, 11:09 AM
KrOW
KrOW - avatar
+ 2
That's a great list. Thanks for sharing!
21st Apr 2018, 11:14 AM
Russ
Russ - avatar
0
👍👍👍
21st Apr 2018, 11:03 AM
KrOW
KrOW - avatar
0
👍👍👍
21st Apr 2018, 11:20 AM
KrOW
KrOW - avatar