0

Can’t change HTML element on Submit

I’ve been trying to create a program that gets a number as an input and outputs an array directly related to that number in the HTML paragraph. I’m not sure how to do this. Every time I run the code the array is undefined and there’s a script error. Here is a simpler version of this code: https://code.sololearn.com/WBJqK1x6cRb3/?ref=app

29th Jul 2018, 2:47 PM
Val
Val - avatar
5 odpowiedzi
+ 2
Does this do what you want it to do? https://code.sololearn.com/W6x8Zc3RMFc4/?ref=app
29th Jul 2018, 3:12 PM
Russ
Russ - avatar
+ 1
Change "getElementByTagName" to "getElementsByTagName". Also, what are you wanting to be displayed in the alert box?
29th Jul 2018, 3:07 PM
Russ
Russ - avatar
+ 1
Yes, thank you! (:
29th Jul 2018, 3:13 PM
Val
Val - avatar
+ 1
No problem 😉
29th Jul 2018, 3:13 PM
Russ
Russ - avatar
0
The array should be alerted when it’s about to replace “result” from the paragraph. it always says “undefined”. I used it to know if my list ever got created... It never gets created
29th Jul 2018, 3:11 PM
Val
Val - avatar