I'm trying to fill a select list with the values entered in an input text box when the user clicks on a button. For eg:
HTML:
<form>
<h2>Add EVENT/MARKET/SELECTION ID </h2>
<select id="id_type">
<option value="sEVENT">Event</option>
<option value="sEVMKT">Market</option>
<option value="sSELCN">Selection</option>
</select>
<input id="entered_id" type="number"/>
<button id="add_id" onclick="populateList()">Add</button>
</form>
<form>
<h2>Entered IDs</h2>
<select id="list_id" size="10" multiple="true"></select>
</form>
JS:
function populateList() {
var events_id = document.getElementById('entered_id').value;
/*I want this events_id to be entered to the select list "list_id"*/
}
I tried $("#list_id").append(events_id) but that didn't work. Any help is appreciated. Thanks