All Collections
Membership
Surveys & Forms
How do I hide a question until someone answers Yes?
How do I hide a question until someone answers Yes?
Updated over a week ago

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.

 

$("#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();
  }
});

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


  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();
       }
    })
  }
Did this answer your question?