i want get element by id but if i'm using the getElementById and passing the correct id so im getting the error of "Uncaught TypeError: Cannot read properties of undefined (reading 'getElementById')"
List item html
enter code here:
<div class="optionRow">
<label for="option1"> <input class="option" type="radio" value="a" id="option1" name="option">
Option 1 </label>
</div>
enter code here :
javascript
allOptions[1].document.getElementById('option1').innerHTML = data.a;
allOptions[2].document.getElementById('option2').innerHTML = data.b;
allOptions[3].document.getElementById('option3').innerHTML = data.c;
to ask why this error ?