-
-
Save Pebblo/fd0526ccb9047511af2d1302fe39e23a to your computer and use it in GitHub Desktop.
Example of how to automatically check the radio button within the ticket selector using jQuery.
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 already have one | |
function tw_ee_radio_button_checked() { | |
wp_add_inline_script( | |
'ticket_selector', | |
'jQuery( document ).ready(function($) { | |
$(".tkt-slctr-tbl").each(function(){ | |
if( $(this).find(".ticket-selector-tbl-qty-slct:radio").length == 1 ){ | |
$(this).find(".ticket-selector-tbl-qty-slct:radio").prop("checked", true); | |
} | |
}); | |
});' | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'tw_ee_radio_button_checked', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment