PeopleVine

How do I hide a question until someone answers Yes?

By adding this snippet of code to the directions part of the question, you can hide a field and then show it upon the user selecting the Yes option.  You will need to adjust with the IDs associated with the specific question.

 
<script>
$("#s-2677_3474").hide(); 
$("#content_field_2669_3466 input").on("change", function() {
  if ($("#content_field_2669_3466 input:checked").val() == "Yes") {
    $("#s-2677_3474").show(); 
  } else {
    $("#s-2677_3474").hide(); 
  }
});
</script>

Another example shows you how to target the specific survey_no no matter what page it's on.

<script>
  if (curObj.survey_no == 1234) { 
    $("#s-4655_6360").hide(); 
    $("#s-4286_6341").hide(); 

    $("#s-3612_6871").on("change", function() { 
       if ($("input:checked", this).val() == 'Yes') { 
          $("#s-4655_6360").show(); 
          $("#s-4286_6341").show(); 
       } else { 
          $("#s-4655_6360").hide(); 
          $("#s-4286_6341").hide(); 
       } 
    }) 
  } 
</script>
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.