在Firefox上使用Google自动填充时触发javascript事件 [英] Trigger javascript event when using Google auto fill on firefox
问题描述
我有一个表单,我在其中禁用了提交按钮,直到用户输入了所有必填字段。我最初使用onkeyup在必填字段上保留一个标签,并在填写所有必填字段时启用按钮。
I have a form, in which I am disabling the submit button until an user has typed in all the mandatory fields. I was initially using onkeyup to keep a tab on the mandatory fields and enable the button when all the mandatory fields are filled.
但我有用户抱怨他们填写了使用Google工具栏上的自动填充按钮进行表单,并且仍然禁用了提交按钮。
But I had users complaining that they filled in the form using AutoFill button on the Google toolbar and the submit button was still disabled.
我通过为每个输入元素调用onpropertychange事件修复了IE中的这个问题,并且它运行良好。
I fixed this problem in IE by calling the onpropertychange event for each input element and it worked nicely.
但是在Firefox中,我无法找到一个在点击谷歌自动填充按钮时会被触发的事件。
But in firefox, I couldnt find an event which will get triggered when the google autofill button is clicked.
非常感谢。
推荐答案
感谢您的回答。我必须快速回答这个问题,因此我使用'setTimeOut()'函数来检查必填字段并启用提交按钮。
Thanks for your answers. I had to respond quickly to this issue hence I used the 'setTimeOut()' function to check for mandatory fields and enable the submit button.
$().ready(function() {
CheckRequiredFields();
timeOutRtn = setTimeout("AutoMonitorMandatoryField()", "3000");
});
function AutoMonitorMandatoryField() {
if ($("#btnSave").attr("disabled")) {
CheckRequiredFields();
timeOutRtn = setTimeout("AutoMonitorMandatoryField()", "3000");
}
}
crescentfresh - 我将调查DOMAttrModified事件并查看如果我可以让它为我工作。谢谢
crescentfresh - I will look into the DOMAttrModified event and see if I can get it to work for me.Thanks
这篇关于在Firefox上使用Google自动填充时触发javascript事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!