Run a function getting uncaught type error line 24 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Run a function getting uncaught type error line 24

The message when I run the function is 'Cannot read properties of null ("reading add"). I think the problem is how I am using a parameter to hold the location of the select tag I want adding to. Thanks Graeme https://code.sololearn.com/WoEpI59UYMv3/?ref=app

27th Nov 2022, 11:25 AM
Graeme Adamson
Graeme Adamson - avatar
2 Answers
+ 2
try this alert("load in function"); var opt = [1, 56]; alert(opt); addOption(opt[1], selTmp); function addOption(inText, inLocation){ var x = document.getElementById("selTmp"); var option = document.createElement("option"); option.text = inText; x.add(option); }
27th Nov 2022, 12:00 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
addOption(opt[1], "selTmp"); and an end tag </body>
27th Nov 2022, 12:14 PM
SoloProg
SoloProg - avatar