0

Собственно первый раз автозаполнение работает. Когда открываю диалоговое окно второй раз то автозаполнение уже не работает.

        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="название компонента" type="text" maxlength="50"><button class="addComponent" >Добавить компонент</button>
    </div>
4
  • как бы код посмотреть?, иначе ответом на ваш вопрос может быть только "видимо у вас что то не работает" 12 окт 2016 в 10:07
  • Сейчас попробою подрезать лишнее.
    – helloWorld
    12 окт 2016 в 10:13
  • попробуйте написать автокомплит в хендлере $(".dialog_create_product").on( "dialogopen", function( event, ui ) {$( ".getInputComponent" ).autocomplete({source: ['1','2','3']});} ); а не в конструкторе как у вас, и отпишите результат 12 окт 2016 в 10:30
  • Может лучше так? $(document).on( "dialogopen", function( event, ui ) {$( ".getInputComponent" ).autocomplete({source: ['1','2','3']});} ); все равно срабатывает только единожды. C $(".dialog_create_product").on вообще не работает
    – helloWorld
    12 окт 2016 в 10:42

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.