1$(function () {
2 var selectedEleValue = null;
3 $('#basic').editableSelect({
4 onSelect: function (element) {
5 selectedEleValue = element.val();
6 console.log('The val is: ' + element.val() + ' The text is: ' + element.text());
7 }
8 });
9 $('form[action="http://stackoverflow.com/questions/38437449/edit-jquery-editable-select/"]').on('submit', function(e) {
10 if (selectedEleValue != null) {
11 $('#basic').val(selectedEleValue);
12 }
13 })
14});