How can I make my text entry box only appear when I click on the option that has the text entry | XM Community
Skip to main content

Hi,



I am trying to hide the text entry box for my answers with the text entry box unless you click on it. I have found these two codes for multiple answer type questions and single answer type questions but none of them are working. See below:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery('input:text').hide();
  jQuery("(type='checkbox']").change(function(){
    if(jQuery(this).prop("checked") == true){
    var v1 = jQuery(this).attr("id");
    jQuery("id*='"+v1+"~TEXT']").show();
    }else{
    var v1 = jQuery(this).attr("id");
      jQuery("did*='"+v1+"~TEXT']").val('');
    jQuery("]id*='"+v1+"~TEXT']").hide();
    }

  });
});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});

jQuery('input:text').hide();
this.questionclick = function(event,element)
  {    
    if (element.type == 'radio')
    {
      jQuery('input:text').val('').hide();
   jQuery("id*='"+ element.id+"~TEXT']").show();
       
    }
  }

The multiple answer type questions code is working correct, please recheck if you are pasting it correctly.


Leave a Reply