-
AuthorPosts
-
September 30, 2016 at 9:58 pm #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,
EnricoOctober 1, 2016 at 7:41 am #694166Hi enricobaumgart,
Could you post a link to the site in question so that we can take a closer look please?
Thanks,
RikardOctober 1, 2016 at 8:29 am #694179Sure, link below.
October 3, 2016 at 4:18 pm #694704Hi,
Please refer to this post – http://kriesi.at/documentation/enfold/add-onclick-event-to-the-contact-form-submit-button/
Best regards,
YigitOctober 3, 2016 at 4:40 pm #694716Hello,
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
EnricoOctober 7, 2016 at 12:44 pm #696429Hi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.