我使用谷歌应用脚本将输入的信息发送到我的电子邮箱。但是现在它打开了一个显示
的新页面{"result":"success","data":"{\"emailadd\":[\"emailhere\"]}"}
我从这里获得了脚本,但它无法正常工作: https://github.com/dwyl/html-form-send-email-via-google-script-without-server
如果我从上面的链接添加form-submission-handler.js,javascript会隐藏表单并用文本替换它,但实际上并没有向我发送电子邮件
现在是我的表格:
<form style="margin:5px" method="POST" class="pure-form pure-form-stacked" action="https://script.google.com/macros/s/AKfycbxtEjbRqMkB-H-qCSClo1QfCKwOK3LT_b_6y11x_VaINIdmforY/exec">
<input type="text" id="email" type="email" name="emailadd" value="" required placeholder="Email" style="color:#2d2d2d; margin-right:1em;">
<input type="submit" value="Submit" class="btn btn-warning ">
</form>
如果有人在执行表单操作时单击提交按钮,我如何隐藏整个表单并将其替换为某些文本
答案 0 :(得分:0)
您可以为表单标记指定ID,如下所示:
&LT; form id =“Something”&gt;
然后你可以在提交按钮上隐藏你的表单:
$(document).ready(function() {
$('Something').hide(0).fadeIn(1000);
$('form.registerButton').submit(function(e) {
e.preventDefault();// will stop the form being submited...
$(this).hide(1000);
// do changes here...
$( "Something" ).replaceWith( "<form>New form</form>" );
return false;
});
});
更多的帮助和更好的表现,请看:
How to replace HTML code with Jquery
希望这会有所帮助