I have the following select element in my html file:
<select id="usr-slct"> </select> to which I am trying to add some options using javascript in a script tag just before the end of the document's body. Like this:
var selector = document.getElementById("usr-slct"); var newoption = document.createElement("option").text="User1"; selector.add(newoption); I would like to know why this code does not make my page display the new option in the select and how can I make it work as intended?