如何删除一次添加到元素自动完成? [英] How to remove an autocomplete once added to an element?

查看:112
本文介绍了如何删除一次添加到元素自动完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我一个自动完成添加元素,如:

After I add a autocomplete to an element like:

commObj=$("#communityName").autocomplete("auto_commName_backend.php",
                {'onItemSelect': handleItemSelect}, {'extraParams': 'ndo' + ndo});

有没有一种方法,我可以将其禁用或删除自动完成的元素动态?

Is there a way I could disable it or remove the autocomplete for the element dynamically?

我使用从迪伦Verheul修改jQuery的自动完成插件。
<一href=\"http://www.pengoworks.com/workshop/jquery/autocomplete_docs.txt\">http://www.pengoworks.com/workshop/jquery/autocomplete_docs.txt

I am using modified jquery autocomplete plugin from Dylan Verheul. http://www.pengoworks.com/workshop/jquery/autocomplete_docs.txt

推荐答案

您可以用code的下面一行删除自动完成的行为:

You can remove the autocomplete behaviour by using following line of code:

if (jQuery(control).data('autocomplete')) {
  jQuery(control).autocomplete("destroy");
  jQuery(control).removeData('autocomplete');
}

这篇关于如何删除一次添加到元素自动完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆