gpt4 book ai didi

javascript - 未捕获的范围错误 : Maximum call stack size exceeded error and Autocomplete dropdown closing when mouse over for my Autocomplete in Javascript/Jquery

转载 作者:行者123 更新时间:2023-11-30 16:07:59 24 4
gpt4 key购买 nike

我将列表绑定(bind)到自动完成控件,在显示绑定(bind)下拉列表之后,但是当从下拉列表中选择项目时,它没有选择和显示最大调用堆栈大小超出错误,

当我将鼠标悬停在自动完成下拉菜单上时,下拉菜单正在关闭,这里我正在证明我的代码,请告诉我我在哪里做错了。

HTML 代码:

<div style="width: 25%; display: inline-block;" data-bind="foreach: TaskList" id="dvmotherboardsearch">
<input style="width: 100%" type="text" id="search" data-bind="value: name, autoComplete: { label: name, value: id }" class="gray search" />
</div>

JS 文件:

self.memumorysearchlist = function (data, event) {
motherbord.length = 0;
var manufactureUrl;
selectManufacturer = $('#manufacturer').val();
selectChiplist = $('#model').val();
if (selectManufacturer !== "" && selectChiplist !== "")
manufactureUrl = "https://api.pcpartpicker.com/api/2015.1/part/category/list/?apikey=5612661951b24c58979b7bb372c2a1f0809e2dc9&part_type=motherboard" + "&m=" + selectManufacturer + "&c=" + selectChiplist;
$.ajax({
url: "services/MemoryFinderDataProvider.asmx/PcPartpickerList",
type: "POST",
data: "{ 'partlisturl' : '" + manufactureUrl + "'}",
dataType: "json",
contentType: "application/json; charset=utf-8",
error: function (data) {

},
success: function (data) {
var obj;
var xmlDoc = $.parseJSON(data.d);
var xml1 = $(xmlDoc.parts);
for (var i = 0; i < xml1.length; i++) {
obj = {};
obj['label'] = xml1[i].name;
obj['value'] = xml1[i].slug;
motherbord.push(obj);
}
$("#search").autocomplete({
source: motherbord,
minLength: 0,
}).focus(function () {
$(this).autocomplete("search", "");
});
$(document).ready(function () {
$("#search").autocomplete("search", "");
});
}

});
$('#ui-id-1').css('height', '400px');
$('#ui-id-1').css('overflow', 'scroll');
}

最佳答案

我写过

$("#search").autocomplete({
source: motherbord,
minLength: 0,
}).focus(function () {
$(this).autocomplete("search", "");
});

在 $(document).ready(function () {}) 中的 self.memumorysearchlist 末尾;

它工作正常..

关于javascript - 未捕获的范围错误 : Maximum call stack size exceeded error and Autocomplete dropdown closing when mouse over for my Autocomplete in Javascript/Jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36733563/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com