重新打开后,对话框自动完成功能不起作用。
var create_product = function () {
isEdit = false;
$(".dialog_create_product").dialog({
autoOpen: true,
width: 800,
modal: true,
buttons: {},
open: function (event, ui) {
=> $( ".getInputComponent" ).autocomplete({
source: ['1','2','3'],
});
},
close: function (event, ui) {
$(".dialog_create_product").dialog("destroy")
},
beforeClose: function (event, ui) {
closeDialog();
}
});
};
HTML
<div class="divInput"align="center">
<input class = "getInputComponent" placeholder="name" type="text" maxlength="50"><button class="addComponent" >Add</button>
</div>
即使自动完成语句超出对话框功能。
$(".dialog_create_product").on( "dialogopen", function( event, ui ) {$( ".getInputComponent" ).autocomplete({source: ['1','2','3']});} );
或
$(document).on( "dialogopen", function( event, ui ) {$( ".getInputComponent" ).autocomplete({source: ['1','2','3']});} );
答案 0 :(得分:0)
你写了
close: function (event, ui) {
$(".dialog_create_product").dialog("close")
},
转入此
close: function (event, ui) {
$(this).dialog('destroy').remove()
},