我是 WordPress 新手,我使用强大的插件创建了一个表单。 我想在单击提交按钮时显示弹出消息。我点击以下链接
https://timersys.com/how-to-display-a-popup-after-user-submits-
form/
但没有获得成功。请帮忙
最佳答案
按照 Formidable 表单插件文档中提到的这些说明进行操作。 https://formidableforms.com/knowledgebase/javascript-examples/javascript-after-form-submit/#kb-before-redirect
它们还提供了 2 个不同的事件,您可以根据需要使用它们来显示弹出消息。 1) 成功消息后,2) 显示另一个页面的内容后
Before redirect# You may use the frmBeforeFormRedirect event to run custom code before a form is redirected to a new page. Please note that this may only be used if 'Submit with AJAX' is selected in your form's Settings. A basic example is shown below.
<script>
jQuery(document).ready(function($){
$(document).on( 'frmBeforeFormRedirect', function( event, form, response ) {
var formID = $(form).find('input[name="form_id"]').val();
});
});
</script>
The form object includes the form element that was submitted. The response object includes the url that the page will redirect to. This script may be placed in a form's Customize HTML.
将代码 var formID = ...
替换为您的弹出消息代码,或者如果您需要弹出消息的变量,则将其添加到该变量声明之后。
关于wordpress - 在 WordPress 中以强大的形式单击提交按钮后显示弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56260231/