gtm sample on logical questions
<script> | |
$( document ).ready(function() { | |
function hideFirstLogicalQuestions(){ | |
$("#registration-form > section.questions > div:nth-child(9)").hide() | |
$("#registration-form > section.questions > div:nth-child(10)").hide() | |
$("#registration-form > section.questions > div:nth-child(11)").hide() | |
$("#registration-form > section.questions > div:nth-child(12)").hide() | |
$("#registration-form > section.questions > div:nth-child(13)").hide() | |
$("#registration-form > section.questions > div:nth-child(14)").hide() | |
$("#registration-form > section.questions > div:nth-child(15)").hide() | |
} | |
function showFirstLogicalQuestions(){ | |
$("#registration-form > section.questions > div:nth-child(9)").show(1000) | |
$("#registration-form > section.questions > div:nth-child(10)").show(1000) | |
$("#registration-form > section.questions > div:nth-child(11)").show(1000) | |
$("#registration-form > section.questions > div:nth-child(12)").show(1000) | |
$("#registration-form > section.questions > div:nth-child(13)").show(1000) | |
$("#registration-form > section.questions > div:nth-child(14)").show(1000) | |
$("#registration-form > section.questions > div:nth-child(15)").show(1000) | |
} | |
// hide when load the page | |
hideFirstLogicalQuestions(); | |
//FirstLogicalQuestions | |
$("#registration-form > section.questions > div:nth-child(8) > div > div > div > div > ul > li:nth-child(2), #registration-form > section.questions > div:nth-child(8) > div > div > div > div > ul > li:nth-child(2) > a").click( function() { | |
showFirstLogicalQuestions(); | |
}) | |
$("#registration-form > section.questions > div:nth-child(8) > div > div > div > div > ul > li:nth-child(1), #registration-form > section.questions > div:nth-child(8) > div > div > div > div > ul > li:nth-child(3)").click( function() { | |
hideFirstLogicalQuestions(); | |
}) | |
//mobile | |
$("#attendee_answers_attributes_7_chosen_choice_id").on('change', function() { | |
if( this.value == 140802){ | |
showFirstLogicalQuestions(); | |
} else { | |
hideFirstLogicalQuestions(); | |
} | |
}) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment