浏览器自动完成文本框事件,当出现这种情况? [英] browser textbox autocomplete event, when does this happen?
问题描述
如果我不要把自动完成=关闭
我的<输入类型=文本/&GT ;
S上的浏览器有时会填补他们与可能/记忆数据
If i dont put autocomplete="off"
on my <input type="text" />
s the browser will sometimes fill them in with likely/remembered data.
当发生这种情况在DOM负荷生命周期?
When does this happen in the DOM-load-lifecycle?
这似乎是后:
$(function(){ alert('i happen before autocomplete'); });
有哪些形式的自动完成后,会出现一个DOM-load事件?
Is there a dom-load event which occurs after form-autocompletion?
如果有,是什么呢?
如果不是,咩,我能做些什么来执行一些JS在页面加载,而是自动完成后?
If not, meh, what can I do to execute some JS "on page load", but after autocompletion?
解决方案必须是跨浏览器
Solutions needs to be cross browser
感谢
安德鲁
推荐答案
您可以给 $(窗口).load(回调)
一试。这将等到一切都满载(图像等),而不仅仅是后DOM已加载的方式 $(文件)。就绪
一样。
You could give $(window).load(callback)
a try. This will wait until everything is fully loaded (images etc), rather than just after the DOM has been loaded the way $(document).ready
does.
我不是100%肯定它是否自动发生之前完成,但它肯定后发生DOM准备好了。
I'm not 100% sure whether or not it happens before auto complete but it definitely occurs after DOM ready.
另外,您可以尝试注册一个一次性change事件处理时,DOM已准备就绪,像这样:
Alternatively you might try registering a "one-off" change event handler when the DOM is ready like so:
$(document).ready(function() {
$('input').one('click', function() {
// do whatever you wanted to do when it first changed
});
});
这将触发仅在第一次场的变化。唯一的问题是浏览器是否会火的时候,它自动完成更改事件。
This will fire only the first time the field changes. The only question is whether or not the browser will fire the change event when it does the autocompletion.
这篇关于浏览器自动完成文本框事件,当出现这种情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!