-
-
Save Pebblo/dcafaf00741fcfab5b162ca2edd15700 to your computer and use it in GitHub Desktop.
Example of how you can use jQuery to validate 2 email question fields. This example forces an email question with ID 18 to compare with the system email question, if they don't match you can not submit the form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Please do not include the opening PHP tag if you do not already have one | |
// This adds the JavaScript to the checkout page, it compares an email question (with ID 18) | |
// to the system email question and confirms they match. | |
add_action( 'wp_enqueue_scripts', 'tw_ee_comfirm_email_question_match', 11 ); | |
function tw_ee_comfirm_email_question_match() { | |
wp_add_inline_script( | |
'single_page_checkout', | |
"jQuery('.ee-reg-form-attendee-dv').each( function() { | |
jQuery(this).find('input.ee-reg-qstn-18').attr('equalTo', '#' + jQuery(this).find('input.ee-reg-qstn-email').attr('id')); | |
});" | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment