-
AuthorPosts
-
December 18, 2019 at 11:30 pm #1167535
I’ve read through the solutions to this issue but seem to have an error in my implementation. The javascript code’s working outside of WP/Enfold: https://coldspringdesign.com/ltc-button-test.html
This page [https://logisticstrainingcenter.com/dev-authentication-for-discount-code/#tab-id-2] has a custom button:
<input class=”id_vet_mil_click” height=”100%” src=”https://s3.amazonaws.com/idme/buttons/v4/verify-with-idme-green.png” type=”image” value=”Verify Military Credentials” width=”100%” />I have this code in my functions.php file:
/* Verify with ID.me for Veteran/Military status */
function verify_vet_mil_button(){
?>
<script>
(function($){
$(window).load(function() {
$(‘.id_vet_mil_click’).on(function(e){
e.preventDefault();
window.open(‘https://api.id.me/oauth/authorize?client_id=d8c73d118584e3cd966a7990692f5340&redirect_uri=https://ywnos0oef8.execute-api.us-east-2.amazonaws.com/testing/callback&response_type=code&scope=military’,
‘popUpWindow’,
‘height=600,width=500,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes’
);
});
});
})(jQuery);
</script>
<?php
}
add_action(‘wp_footer’, ‘verify_vet_mil_button’);But I’m not able to get the pop-up window working. Can you help?
December 20, 2019 at 2:41 am #1167998Hey coldspring,
Can you give us a link to the page where this is applied? so we can check further and try to inspect the page for js errors.
Best regards,
NikkoDecember 20, 2019 at 8:24 pm #1168309Hi Nikko. That page is https://logisticstrainingcenter.com/dev-authentication-for-discount-code/#tab-id-2 (The buttons are on tabs 2 and 3)
Thanks, Jeff
December 22, 2019 at 8:12 pm #1168614Hi,
I believe the error is in this line:
$('.id_vet_mil_click').on(function(e){
you are using “on” instead of “click” like this:
$('.id_vet_mil_click').click(function(e){
PLease give this a try.Best regards,
MikeDecember 23, 2019 at 4:52 pm #1168766That fixed it! Thanks Mike!
December 24, 2019 at 7:33 am #1168870Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Custom Button Onclick Issue’ is closed to new replies.