使用JavaScript后自动完成功能不起作用

时间:2018-09-09 07:04:59

标签: javascript jquery-ui-autocomplete

Initial Page

After click on add button it will enabled book code textbox and when i enter 2 key it will populate table below

After that when press keydown from book code textbox it will focus on table row and after i press enter on row it will populate in book code and book type textboxes and after focus is move on book name textbox

Book name textbox i implemented keyup js functionality to move focus on book code textbox but, issue is here after that when i press 2 on book code textbox it must be populate table but it not populate

任何人都可以帮助我,为什么自动填充功能在首次使用后不起作用

我的代码在这里

$(document).on("keydown", "#ContentPlaceHolder1_TxtBookName", function (e) {
        if (e.which == 38) {
            var editMode = $("#ContentPlaceHolder1_hdnEdit");
            if (editMode.val() != "true") {
                var submit = $("#ContentPlaceHolder1_BtnSubmit").attr("disabled");
                var add = $("#ContentPlaceHolder1_Btnadd").attr("disabled");
                var cancel = $("#ContentPlaceHolder1_BtnCancel").attr("disabled");
                if (submit == undefined && add == "disabled" && cancel == undefined) {
                    $(ContentPlaceHolder1_txtBookCode2).val(null);
                    $(ContentPlaceHolder1_txtBookType).val(null);                        $(ContentPlaceHolder1_txtBookCode2).removeAttr("disabled");
                    $(ContentPlaceHolder1_txtBookType).attr("disabled", "disabled");
                    $(ContentPlaceHolder1_txtBookCode2).focus();
                }
            }
        }
    });

0 个答案:

没有答案