tagcompletion像计算器 [英] tagcompletion like stackoverflow

查看:175
本文介绍了tagcompletion像计算器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

工作实例

错误


  • 在列表中添加存在的项

  • 添加不列表中存在的项

  • 补充说,通过点击箭头键或点击鼠标的项目列表中存在的项目

  • 通知所有的项目被删除,一切重新开始。

我在<一个提供给我一个解决方案之上构建这个href=\"http://stackoverflow.com/questions/6162449/how-to-get-autocompletion-like-stack-overflow/6162549#6162549\">another问题。我从这个例子所采取的code和修改,以我的需求。但是,现在我有上述的问题。

I am building this on top of a solution provided to me in another question. I've taken the code from that example and modified to my needs. however, now I am having the issue stated above.

我能做些什么,以避免在一个新的项目被添加不存在的项目后,点击向下箭头键添加具有列表中删除的所有项目。

What can I do to avoid having the list erase all items when a new item is added by clicking down arrow key after a non existent item is added.

推荐答案

添加以下到选项对象,你通过自动完成控件:

Add the following to the options object you pass the autocomplete widget:

focus: function() { return false; }

从上焦点文档:

取消此事件prevents的
  从价值被更新,但不
  $ P $被pvent菜单项
  重点突出。

Canceling this event prevents the value from being updated, but does not prevent the menu item from being focused.

下面是你的榜样,而不错误: http://jsbin.com/oquda3/4

Here's your example without the bug: http://jsbin.com/oquda3/4

这篇关于tagcompletion像计算器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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