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
2 Respuestas
+ 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);
}
+ 2
addOption(opt[1], "selTmp");
and an end tag </body>