Javascript 由于属性:上下文中的值非法而失败

Javascript 由于属性:上下文中的值非法而失败,javascript,jquery,google-apps-script,Javascript,Jquery,Google Apps Script,我有一个使用jquery、jquery ui和jquery mobile的google应用程序脚本。html是一个带有按钮的简单表单: <input type="button" value="Submit" onclick="google.script.run .withSuccessHandler(updateOutput) .processForm($('#form'))" /> 代码很模糊,我无法理解。我尝试在process

我有一个使用jquery、jquery ui和jquery mobile的google应用程序脚本。html是一个带有按钮的简单表单:

<input type="button" value="Submit"
      onclick="google.script.run
          .withSuccessHandler(updateOutput)
          .processForm($('#form'))" />
代码很模糊,我无法理解。我尝试在processForm中使用Logger.log,但在View->Logs中没有显示任何内容。执行记录如下:

[14-12-25 17:06:15:613 IST] Starting execution
[14-12-25 17:06:15:649 IST] Execution succeeded [0.0 seconds total runtime]
如果我设置了断点,脚本不会停止,我想这是因为它是作为web应用程序部署的,我可以更改它吗?

processForm方法需要的是本机HtmleElement参数,而不是jQuery上下文

试试这个:

<input type="button" value="Submit"
  onclick="google.script.run
      .withSuccessHandler(updateOutput)
      .processForm($('#form').get(0))" />
请参见

Yes,或者只需处理表单$'form'[0]。
<input type="button" value="Submit"
  onclick="google.script.run
      .withSuccessHandler(updateOutput)
      .processForm($('#form').get(0))" />