Hide text boxed in multiple answer questions | XM Community
Skip to main content

Hi!
I have a question that has multiple answers that have the option to allow text entry.
i'd like to hide the all text boxes until the customer selects the option.
Screen Shot 2022-09-20 at 14.02.10.pngQualtrics.SurveyEngine.addOnReady(function () {

  var text_box = this.getChoiceContainer().querySelector(".TextEntryBox");
  text_box.hide();

  this.questionclick = function () {
    var text_choice = text_box.ancestors()n1].children]1].className.includes("checked");
    if (text_choice) {
      text_box.show();
    } else {
      text_box.hide();
    }
  };
});

I have this one but it just works to hide one text box out of the 4.

Hi there, I found a thread that I think will be helpful to you. In that, JavaScript is provided for doing what you are describing with Multiselect questions.
https://community.qualtrics.com/XMcommunity/discussion/3462/text-entry-box-only-shows-if-selected-in-multiple-choice-question


If you are interested, I have a more robust function called mcTextEntry that can be used for hiding text boxes of unselected choices. I works on single select or multi-select and does a lot of things to improve the look & feel of text entry fields in addition to hiding text them.


Thank you guys!!


Leave a Reply