JSFiddle - React, Tailwind, and code Playground

by jpwo759

HTML

<select id="dd">
  <option>1</option>
  <option>2</option>
  <option>3</option>
  <option>4</option>
  <option>5</option>
</select>

<button id="btnClear" type="button">
  Click
</button>

JavaScript

function clear()
{
var theDD = document.getElementById('dd')
	theDD.options.length = 0;
  
  theDD.options.add(new Option("test1","test1",false,false));
  
  
}

document.getElementById('btnClear').addEventListener('click',clear);