Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #694048

    Hi, I’m trying to add a custom onclick event to one of my send button of a form.

    I added this to my functions.php:

    function trigger_func_on_custom_button(){
    ?>
    <script>
        (function($){
            $(window).load(function() {
        	   $('.OptIn_Form input[type="submit"]').on('click', function() {
                    if (!$('.OptIn_Form p').hasClass('error')) {
                        ga('send’, 'event', 'OptIn', 'Eingetragen', 'MH_Seite');
                    }
                    e.preventDefault();
                    location.href='http://#ulp-9udMtdl3BptjK3VR';
                });
            });
        })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'trigger_func_on_custom_button');

    My form got the custom class OptIn_Form.

    But when I click the button, nothing happens. I expect to open a popup (“Layered Popups”) after submitting the form.

    Do I have to modify this code?

    e.preventDefault();
    location.href='http://#ulp-9udMtdl3BptjK3VR';

    Thanks for help,
    Enrico

    #694166

    Hi enricobaumgart,

    Could you post a link to the site in question so that we can take a closer look please?

    Thanks,
    Rikard

    #694179

    Sure, link below.

    #694704
    #694716

    Hello,
    Thanks, I already read this (POST). But it doesn’t help to solve my issue. Because your function adds a tracking code to each button of the website. I’m trying to add code to just ONE of the submit buttons.
    And the main point is to add a code which opens a layered popup after submitting the form.

    Thanks & best regards
    Enrico

    #696429

    Hi,

    Unfortunately it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However if its really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Andy

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.