I am writing an dynamic data list. However, when I tried to update the list, the previous didn't clear. Are there any solutions?
Here is my code
function loadDataList(selectedSchoolName)
{
var options = '';
//document.getElementById('schoolNameList').remove();
for(var i = 0; i < selectedSchoolName.length; i++)
{
options += '<option value="'+ selectedSchoolName[i] +'" >';
}
document.getElementById('schoolNameList').innerHTML = options;
}
Thank You