js method of adding options to selected

  • 2020-06-07 04:01:27
  • OfStack

This article illustrates how js adds options to selected. Share to everybody for everybody reference. Specific implementation methods are as follows:


<select id="Mmonth">
<option>1</option>
</select>
<input type="button" onclick="a()" value=" add "/>
<script>
function a(){
 document.getElementById("Mmonth").options.add(new Option(1,1));
}
</script>

Hopefully, this article has been helpful in your javascript programming.


Related articles: