Pop up AcyMailing subscription form

Joomla Asked by ygiorgos on September 5, 2021

I am trying to build a Joomla website with an AcyMailing subscription form.

I’d like the form to be a pop-up window. I have researched thoroughly and I have achieved most of what I want.

Now I have a pop-up form (as an AcyMailing subscription module), but the form closes when I click in the form.

When I click outside the form, it does nothing — as desired.

Here is the code I am using:

// When the user clicks on <div>, open the popup
function myFunction() {
  var popup = document.getElementById("myPopup");
<div class="popup" onclick="myFunction()">CLICK HERE TO SUBSCRIBE
    <span class="popuptext" id="myPopup">
        <table class="acym_form">
            *(the acy mailing form module here)*

Does anyone have a solution for this?

One Answer

I see that you have modelled your development upon this page:

However, that demo has a separation between the element with the click event and the element to be toggled.

Your snippet has the popup element nested inside of the clickable element (there is a parent-child relationship). Your issue pertains to the fact that clicking on the child(ren) will trigger the event listener bound to the parent.

This is a reproduction of your issue:

To resolve the matter, you merely need to break the parent-child relationship that your popup currently has.

<div class="popup" onclick="myFunction()">CLICK HERE TO SUBSCRIBE</div>

will do the trick. If you move the </div> in my demo link, you will successfully eliminate the unwanted behaviour.

Correct answer by mickmackusa on September 5, 2021

Add your own answers!

Related Questions

Getting Category’s custom fields in a blog view

1  Asked on September 5, 2021 by semaphore


How to post checkout data to component using Ajax?

1  Asked on September 5, 2021 by askerman


Display specific Joomla user groups

1  Asked on September 5, 2021 by niaziblog


how to get value for search in joomla module

1  Asked on September 5, 2021 by rhea-lorraine


Joomla installation on localhost using WAMP does not start

1  Asked on September 5, 2021 by bilal-kabeer-butt


Jquery script loaded on every page

1  Asked on September 5, 2021 by gag


category links don’t work

1  Asked on September 5, 2021 by giovanni-de-maria


Joomla 3.9 Child Sub Menu Not Showing

1  Asked on September 5, 2021 by ta1982


Trying to connect to an external ODBC data source

1  Asked on September 5, 2021 by irata


Can’t get a task to work from CLI

0  Asked on September 5, 2021 by tc0072


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP