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 Answers
+ 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