I am trying to append the values to dropdown using below line of javascript code the values that i get in the option are correct but the issue is with the code in my aspx page
ddlCountries.appendChild(option);
Below is my aspx code
I am trying to append the values to dropdown using below line of javascript code the values that i get in the option are correct but the issue is with the code in my aspx page
ddlCountries.appendChild(option);
Below is my aspx code
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
avairPosted May 29, 2023, 8:36 AM
this append child is at the end of the function only
Amit MohantyPosted May 29, 2023, 8:13 AM
The error message "Uncaught TypeError: Cannot read properties of null (reading 'appendChild')" indicates that the
ddlCountrieselement is null. Make sure the JavaScript code is executed after theddlCountriesdropdown is rendered on the page. Placing the JavaScript code at the end of the page can help ensure that the dropdown element exists before accessing it.avairPosted May 29, 2023, 8:08 AM
getting error as Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
Amit MohantyPosted May 29, 2023, 5:52 AM
try this once:
avairPosted May 27, 2023, 6:25 PM
Tried this as well but it's not working its ext gridview
Naimish MakwanaPosted May 27, 2023, 4:42 AM
Try below code:
Thanks