What is wrong with this!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is wrong with this!!

Please take a look at the JS code and tell me what is the problem. Link: https://code.sololearn.com/W3X9IJff9H4H/#js

30th Jan 2018, 4:49 PM
Akib
Akib - avatar
9 Answers
+ 2
changeclass[i].classList.remove("newclass", "onetherclass"); changeclass[i].classList.add("poor");
30th Jan 2018, 5:37 PM
John Wells
John Wells - avatar
+ 3
ab is called prior to body load. move it from line 14 to between 6 and 7.
30th Jan 2018, 5:12 PM
John Wells
John Wells - avatar
+ 2
you should probably have function ab, not functon
30th Jan 2018, 4:56 PM
michal
+ 2
Sure. Elements can have multiple classes so you need to remove any you don't want.
30th Jan 2018, 5:26 PM
John Wells
John Wells - avatar
+ 2
There won't be any errors having classes that aren't used.
30th Jan 2018, 5:38 PM
John Wells
John Wells - avatar
+ 2
Thank you.☺
30th Jan 2018, 5:41 PM
Akib
Akib - avatar
+ 1
No i fixed it earlier. It still says innerHTML unable to change property
30th Jan 2018, 5:04 PM
Akib
Akib - avatar
+ 1
Thanks @john wells But it still doesn't change the class. Can you help with that?
30th Jan 2018, 5:23 PM
Akib
Akib - avatar
+ 1
I wanted to change (remove old one) the class of one tag. How can I do that?
30th Jan 2018, 5:30 PM
Akib
Akib - avatar