diff --git a/src/modules/form.js b/src/modules/form.js index 8ed766e2..3923f54d 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -500,7 +500,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ // 未查询到相关值 if(none){ - initValue = $(select[0].options[selectedIndex]).text(); // 重新获得初始选中值 + initValue = $(select[0].options[selectedIndex]).prop('text'); // 重新获得初始选中值 // 如果是第一项,且文本值等于 placeholder,则清空初始值 if(selectedIndex === 0 && initValue === input.attr('placeholder')){ @@ -706,7 +706,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ input.on('input propertychange', layui.debounce(search, 50)).on('blur', function(e){ var selectedIndex = select[0].selectedIndex; - initValue = $(select[0].options[selectedIndex]).text(); // 重新获得初始选中值 + initValue = $(select[0].options[selectedIndex]).prop('text'); // 重新获得初始选中值 // 如果是第一项,且文本值等于 placeholder,则清空初始值 if(selectedIndex === 0 && initValue === input.attr('placeholder')){ @@ -728,6 +728,17 @@ layui.define(['lay', 'layer', 'util'], function(exports){ if(othis.hasClass(DISABLED)) return false; + // 将新增的 option 元素添加到末尾 + if(isCreatable && othis.hasClass(CREATE_OPTION)){ + var optionElem = $('