+ 1

Why not working?? Help! {Solved}

This code is not giving the output. https://code.sololearn.com/WrnZy7jx3m69/?ref=app

1st Jul 2021, 9:01 AM
Anas Dharar
Anas Dharar - avatar
5 Réponses
+ 3
getElementsByClassName returns a nodeList of elements having same class name. So, you need to individually select the element you need, by indexing . Also p element doesn't have a value attribute . correct code, var result = document.getElementsByClassName("result")[0].textContent=ans; }
1st Jul 2021, 9:05 AM
Abhay
Abhay - avatar
+ 2
Thank you Abhay!!
1st Jul 2021, 9:08 AM
Anas Dharar
Anas Dharar - avatar
0
But it's working
1st Jul 2021, 9:45 AM
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika)
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika) - avatar
0
pallu dolu i wrote its solved
1st Jul 2021, 10:31 AM
Anas Dharar
Anas Dharar - avatar
0
Okay Anas Dharar
1st Jul 2021, 10:44 AM
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika)
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika) - avatar