【问题标题】:How to hide a form when someone submits and replace it with another text?当有人提交并用另一个文本替换它时如何隐藏表单?
【发布时间】:2016-06-21 07:14:47
【问题描述】:

我是谷歌应用程序脚本,用于将输入的信息发送到我的电子邮件。但现在它会打开一个显示

的新页面
{"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>

当有人在执行表单操作的同时单击提交按钮时,我如何隐藏整个表单并替换一些文本

【问题讨论】:

    标签: javascript php jquery html forms


    【解决方案1】:

    你可以像这样给你的表单标签一个 id:

    然后您可以在提交按钮上隐藏您的表单:

    $(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

    希望这会有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-22
      • 2011-04-08
      • 1970-01-01
      • 1970-01-01
      • 2013-08-29
      相关资源
      最近更新 更多