Hi I am trying to make sure that my text entry box only appears when I click on the option that has an entry box. I have a code that works for a multiple answer type of question but it does not work for a single answer type of questions. See below the Java Scrip.
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*/
});
Thanks,
Page 1 / 1
Try the below code:
jQuery('input:text').hide();
this.questionclick = function(event,element)
{
if (element.type == 'radio')
{
jQuery('input:text').val('').hide();
jQuery("(id*='"+ element.id+"~TEXT']").show();
}
}
Thank you so much it is working now :)
Hi, I have the same issue but can not get any of these codes to work.
Is there JS for doing this for a multi-select?
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.