- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
08-17-2020 08:29 AM
Hi!
There's are 3 radio buttons with the name payment[method] and the user selection has to be captured and assigned to a Google Analytics event as a label when the user clicks the submit button.. So I have this code in the Custom option of the onclick handler extension listening to the mousedown on the submit button.
b["js_page.ga_eventCategory"]="Click Tracking";
b["js_page.ga_eventAction"]="Payment Method";
b["js_page.ga_eventLabel"]= jQuery("input(name='payment[method]'):checked").val();
The event is not firing. If I comment out the label line it goes on an infinite processing loop. If I try this in the link option also only the event is firing but the label is 'not set'. Is there anything wrong in my code? I tried to get the value on the onHandler code listening to a mousedown on all radio buttons with the name payment[method] but no success there as well. Also, am I to understand console.log does not work for DOM Ready extensions? Then how do I test the code? Any suggestions? Thanks a lot!
Sujani
Solved! Go to Solution.
09-06-2020 09:04 AM - edited 09-06-2020 09:05 AM
Hi @sujani_koya ,
Its been week, you would have resolved the issue, if not there is an error in jQuery syntax.
Your syntax:
jQuery("input(name='payment[method]'):checked").val();
Syntax should be
jQuery("input[........]:checked").val();
instead of round brackets you should use square brackes.
Thanks
Copyright All Rights Reserved © 2008-2023