Very simple and straight forward. I pre-populated a HTML datalist with values, on the form when I want select a value and insert it into SQLite database. This is my example
<input list="Model" id="ModelList" placeholder="Select Model">
<datalist id="Model">
<option value="A">
<option value="B">
<option value="C">
<option value="D">
</datalist>
<script>
var dataset= document.getElementById("ModelList").value;
alert(dataset);</script>
I would use '.on()':
HTML
<input type="text" name="display" id="display" value="" list="list-display" />
<datalist id="list-display">
<option>Name</option>
<option>Id</option>
</datalist>
Javascript
$("#display").on('input',function(e){
alert($(this).val());
});
try .val() instead :
var relationshipTemp = $('#TypeList option:selected').val();