gpt4 book ai didi

JQuery UI 自动完成,在输入字段中键入更多字符时隐藏 div

转载 作者:行者123 更新时间:2023-11-28 00:05:22 33 4
gpt4 key购买 nike

我有一个用 JQuery UI 自动完成填充的输入字段。目的是检查数据库中是否已存在该值。

当选择存在时,会显示#warning div :

$("#item").autocomplete({
source: function(request, response) {
$.getJSON(
"search.php",
{ term:request.term, type:'item' },
response
);
},
minLength: 3,
select: function(event, ui) {
$("#warning").show();
$("#item").html('');
}

我希望在用户选择条目但添加一些字符时隐藏#warning div。

我不知道该怎么做。

感谢您的帮助。

最佳答案

通过在调用自动​​完成时简单地添加一个 hide() 函数来解决:

$("#item").autocomplete({
source: function(request, response) {
$.getJSON(
"search.php",
{ term:request.term, type:'item' },
response
);
$("#warning").hide();
},
minLength: 3,
select: function(event, ui) {
$("#warning").show();
$("#item").html('');
}

关于JQuery UI 自动完成,在输入字段中键入更多字符时隐藏 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55731804/

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