📜  e 可编辑选择无按钮 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:12.734000             🧑  作者: Mango

代码示例1
$(function () {
  var selectedEleValue = null;
  $('#basic').editableSelect({
    onSelect: function (element) {
      selectedEleValue = element.val();
      console.log('The val is: ' + element.val() + ' The text is: ' + element.text());
    }
  });
  $('form[action="http://stackoverflow.com/questions/38437449/edit-jquery-editable-select/"]').on('submit', function(e) {
    if (selectedEleValue != null) {
      $('#basic').val(selectedEleValue);
    }
  })
});