Created
May 14, 2020 13:08
-
-
Save Pebblo/d2b24f3a8a8713146e495c3a9cc2e3e1 to your computer and use it in GitHub Desktop.
Example of how to use jQuery to set the defautl value of the EE State dropdown. Change val(45) to the ID of the state you wish to use.
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, except of course if you're starting with a blank file | |
function tw_ee_default_state_option(){ | |
wp_add_inline_script( | |
'single_page_checkout', | |
"jQuery(document).ready(function($){ | |
$('select.ee-reg-qstn-state').val(45).prop('selected', true); | |
});" | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'tw_ee_default_state_option', 50 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment