JSFiddle - React, Tailwind, and code Playground

HTML

<p>when you change option, the refreshOptions function will run and removes all options and replace them with the new option</p>
<select id="city" onchange="refreshOptions();">
    <option value="1">option 1</option>
    <option value="2">option 2</option>
    <option value="3">option 3</option>
</select>

JavaScript

function refreshOptions() {
	// remove all options from select
	var selectElement = document.getElementById('city');
  
  // remove old option elements
  selectElement.options.length = 0;
  
	// create new option element
	var newOptionElement = document.createElement('option');
	newOptionElement.value = "optionValue";
	newOptionElement.innerHTML = "option display text";
  
	// add the new option into the select
	selectElement.appendChild(newOptionElement);
}