Last active
November 6, 2018 01:11
-
-
Save joshfeck/183209d5239cc07ec94f9ebbfb017d40 to your computer and use it in GitHub Desktop.
Example of how to conditionally hide/show a text question based on a drop down question value. Works with Event Espresso 4
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 | |
// In this example the *text* question div class is .ee-reg-qstn-13-input-dv | |
// and the *dropdown* question input class is .ee-reg-qstn-12 | |
function ee_custom_show_question_conditionally() { | |
wp_add_inline_script( | |
'ee_form_section_validation', | |
'jQuery( document ).ready(function($) { | |
var text = $(".ee-reg-qstn-13-input-dv"); | |
$(text).hide(); | |
$(".ee-reg-qstn-12").change(function() { | |
$(this).val() == "other" ? | |
$(text).show() : | |
$(text).hide(); | |
}); | |
});' | |
); | |
} | |
add_action( | |
'wp_enqueue_scripts', | |
'ee_custom_show_question_conditionally', | |
11 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment