火狐捕捉自动完成输入更改事件 [英] FireFox capture autocomplete input change event

查看:131
本文介绍了火狐捕捉自动完成输入更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想订阅改变输入标签事件的AJAX自动完成表单。当用户点击从Firefox的自动完成建议这些变化事件不是射击。

I'm trying to subscribe to change events on an input tag for an ajax auto complete form. These change events are not firing when the user clicks an autocomplete suggestion from FireFox.

我已经看到了IE修复,而不是Firefox浏览器。你可以在这里查看这种行为

I've seen fixes for IE, but not FireFox. You can view this behavior here

步骤重现:
在框中键入之一任何输入,然后点击提交。

Steps to recreate: type any input in one of the boxes and click submit.

开始在同一个框中再次输入该值。

Start typing the value again in the same box.

您应该看到自动完成意见箱出现下面的输入框中。请注意,点击建议不火的change事件(它也不会触发click事件)

You should see the autocomplete suggestion box appear below the input box. Notice that clicking the suggestion does not fire the change event (it also doesn't fire the click event)

目前我唯一的选择就是在这个领域禁用自动完成,但我并不想这样做。

Currently my only option is to disable autocomplete on this field, but I do not want to do that.

推荐答案

如果它让你感觉更好,这是一个的已知的bug

If it makes you feel better, it is a known bug

建议的解决方法:(不是我的,从<一个href=\"http://forums.mozillazine.org/viewtopic.php?f=38&t=584166&start=0&st=0&sk=t&sd=a\">here

Proposed workaround: (Not mine, from here

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Mozilla Firefox Problem</title>
<script type="text/javascript">
function fOnChange()
{
  alert('OnChange Fired');
}

var val_textBox;

function fOnFocus()
{
  val_textBox = document.getElementById('textBox').value;
}

function fOnBlur()
{
  if (val_textBox != document.getElementById('textBox').value) {
    fOnChange();
  }
}
</script>
</head>
<body>
<form name="frm">
<table>
<tr>
<td><input type="text" id="textBox" name="textBox" onFocus="fOnFocus()" onBlur="fOnBlur()"></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</form>
</body>
</html>

这篇关于火狐捕捉自动完成输入更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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