无法使用 Javascript 在 Google 表单上设置输入值
Unable to set a input value on Google Forms using Javascript
我正在尝试为 google 表单创建自动填充扩展,但我无法更改 input/textarea 值。这是 content.js document.getElementsByClassName('quantumWizTextinputPapertextareaInput exportTextarea')[0].value = "Some Answer"
This is what happens on google forms
上的代码
如果我尝试提交它,我会收到一条错误消息,提示该问题是必答题
The error
如果我在输入中键入或删除某些内容,那么它会识别文本并且我可以提交它。我真的希望有人能帮助我 Here is the form link
我使用 execCommand
找到了解决此问题的方法。由于google 表单使用jscontroller 和jsaction 动态执行js,所以只设置值是不行的。
document.getElementsByClassName("quantumWizTextinputPapertextareaInput exportTextarea")[0].focus();
document.execCommand('insertText', false, 'Some Answer');
我正在尝试为 google 表单创建自动填充扩展,但我无法更改 input/textarea 值。这是 content.js document.getElementsByClassName('quantumWizTextinputPapertextareaInput exportTextarea')[0].value = "Some Answer"
This is what happens on google forms
如果我尝试提交它,我会收到一条错误消息,提示该问题是必答题 The error
如果我在输入中键入或删除某些内容,那么它会识别文本并且我可以提交它。我真的希望有人能帮助我 Here is the form link
我使用 execCommand
找到了解决此问题的方法。由于google 表单使用jscontroller 和jsaction 动态执行js,所以只设置值是不行的。
document.getElementsByClassName("quantumWizTextinputPapertextareaInput exportTextarea")[0].focus();
document.execCommand('insertText', false, 'Some Answer');