本文介绍了文本框的浏览器自动完成选项不火键preSS / KEYUP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个<输入类型=文本> 绑定带有键preSS活动,如下(见的jsfiddle这里: http://jsfiddle.net/periklis/RMyc7/ ):

I have an <input type = "text"> binded with a "keypress" event, as follows (see jsfiddle here: http://jsfiddle.net/periklis/RMyc7/):

<form name = "myform" method = "post">
    <input type = "text" name = "mytext" id = "text_id"/>
    <input type = "submit"/>
</form>
<script>
$(document).ready(function() {
    $('#text_id').bind('keyup', function() {
        console.log('pressed!');
    });
});
</script>​

我的问题是,如果我选择的字段(previously输入的值)浏览器的建议之一,则KeyUp事件不会触发。你有什么建议我应该做的,以解决此问题?

My problem is that if I select one of the browser recommendations for the field (previously entered values), then the keyup event won't fire. What do you suggest I should do to work around this?

测试铬17和Firefox 10

Tested on chromium 17 and Firefox 10

感谢一如既往

推荐答案

我结束了设置自动完成=关闭我的领域prevent这种情况的发生。

I ended up setting 'autocomplete=off' to my field to prevent this from happening

这篇关于文本框的浏览器自动完成选项不火键preSS / KEYUP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 19:28