退格键触发事件,但删除键不触发事件

发布于 2024-09-02 15:38:35 字数 211 浏览 3 评论 0原文

我有一个表单字段,它使用 Jorn Zaefferer 的“自动完成”jQuery 插件。如果我输入一些文本,然后选择其中的一部分并按退格键,自动完成列表就会更新。但如果我点击删除而不是退格键,自动完成列表就会消失。

我正在查看该插件的代码,看起来自动完成更新程序是由字段中的按键事件触发的,并且退格键和删除都会触发按键。

退格键和删除键之间是否存在可能导致此问题的根本区别?

I have a form field which uses Jorn Zaefferer's "autocomplete" jQuery plugin. If i type some text, then select part of it and hit backspace, the autocomplete list updates. But if i hit delete instead of backspace, the autocomplete list disappears.

I'm looking at the code for the plugin and it looks like the autocomplete updater is triggered by a keydown event in the field, and both backspace and delete trigger a keydown.

Is there a fundamental difference between backspace and delete that could be causing this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦中的蝴蝶 2024-09-09 15:38:35

如果您查看 onChange() 方法Del 有一个特殊的目的 - 隐藏自动完成列表:

function onChange(crap, skipPrevCheck) {
    if( lastKeyPressCode == KEY.DEL ) {
        select.hide();
        return;
    }

所以不,这里的事件行为没有根本的区别,这只是自动完成插件的设计方式,删除键专门用于隐藏列表。

If you look at the onChange() method, Del has a special purpose - to hide the autocomplete list:

function onChange(crap, skipPrevCheck) {
    if( lastKeyPressCode == KEY.DEL ) {
        select.hide();
        return;
    }

So no, there's no fundamental difference in event behavior here, this is just how the autocomplete plugin is designed, the delete key is specifically intended to hide the list.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文