If i dont put autocomplete="off"
on my <input type="text" />
s the browser will sometimes fill them in with likely/remembered data.
When does this happen in the DOM-load-lifecycle?
It appears to be after开发者_运维问答:
$(function(){ alert('i happen before autocomplete'); });
Is there a dom-load event which occurs after form-autocompletion?
If so, what is it?
If not, meh, what can I do to execute some JS "on page load", but after autocompletion?
Solutions needs to be cross browser
Thanks
Andrew
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.
I'm not 100% sure whether or not it happens before auto complete but it definitely occurs after DOM ready.
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.
精彩评论