我正在使用一个插件(boxzilla)显示一个带有新闻稿订阅表单的弹出窗口,该表单连接到mailchimp。
我的目标是access to a file, right after entering the email adress (并注册到新闻稿)。
到目前为止,我写了一个脚本,它应该打开一个链接(根据stackoverflow-post-3749231), 单击新闻稿表单的提交按钮后。但这不起作用:
Popup
<div class="newsletter_popup">
<div class="newsletter_textbox">
Some text
<!-- newsletter form -->
[mc4wp_form id="1234"]
<!-- The Download-link -->
<a href="https://docs.google.com/uc?id=0B0jH18Lft7ypSmRjdWg1c082Y2M" download id="download" hidden></a>
</div>
</div>
<script>
// select the button inside the mailchimp form
jQuery(\'.popup-newsletter_button\').click(function(){
document.getElementById(\'download\').click();
});
</script>
LINK on Page
<!-- opens the popup \'boxzilla-1\' -->
<a href="#boxzilla-1" rel="nofollow">Open Box</a>
FORM ([mc4wp\\U form id=“1234”])
<form id="mc4wp-form-1" class="mc4wp-form mc4wp-form-1234" method="post" data-id="1234" data-name="Newsletter Registration">
<div class="mc4wp-form-fields">
<div rel="text" class="popup-newsletter_email">
<input type="email" name="EMAIL" required="">
</div>
<div rel="text" class="popup-newsletter_button">
<input type="submit" value="Anmelden">
</div>
</form>
提交后
the popup reloads 并显示一些“谢谢”文本(mailchimp插件),我想我必须把脚本放在其他地方?似乎我无法访问提交按钮:
//Doesn\'t work either
jQuery(\'#mc4wp-form-1\').submit(function(e) {
document.getElementById(\'download\').click();
}
一般来说,实现这项任务的最佳做法是什么?