我正在为我们的应用程序使用Jquery自动完成功能。
我面临的问题是,无法清除“自动完成”过程中捕获的结果。(要添加到div的数据是cleardiv)
当我尝试单击按钮手动清除它时,自动完成功能不起作用。
<input type='text' title='Tags' id='tags' />
<div class="autoSearch_result_Wrap" id="Tags_result"></div>
<input type="button" id="cleardiv" value="Clear" name="Clear"><br>
$(document).ready(function() {
var aTags = ["ask","always", "all", "alright", "one", "foo", "blackberry", "tweet","force9", "westerners", "sport"];
$( "#tags" ).autocomplete({
source: aTags ,
minLength: 2,
appendTo: "#Tags_result",
});
$(document).on('click', '#cleardiv', function(event) {
$('#Tags_result').empty();
});
});
您能否让我知道如何解决这个问题?
我使用的是chrome,一旦离开文本框,标签就会清除。你使用的是什么浏览器?
试试这个作为测试
$('#cleardiv').on('click', function(event) {
$('#tags').blur();
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句