Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
26th Nov 2023, 11:36 AM
JaScript
JaScript - avatar
+ 4
First you cannot call a function with dot. Second you access a collection. Third the called name of class is incorrect. This works: var p = 0; var ps = 1; function Add(x){ p+=ps; document.getElementsByClassName("p"+x)[0].innerText = p }
26th Nov 2023, 11:19 AM
JaScript
JaScript - avatar
+ 3
Firstly, remember that with Sololearn's compiler you need to wrap your JavaScript tab in the window.onload function. Maybe looking at this code might help you find some of your other errors: https://code.sololearn.com/WmW291DVWMP8/?ref=app
26th Nov 2023, 11:10 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
The Smart One You are welcome!
27th Nov 2023, 9:28 PM
JaScript
JaScript - avatar