multiple choice -> text entry (hidden) | XM Community
Solved

multiple choice -> text entry (hidden)


Userlevel 2
Badge +3
How to achieve the beginning of the text entry is hidden, the text entry appears when the other option is selected,like this.
!!
thanks a lot.
icon

Best answer by elf 28 May 2019, 21:01

View original

5 replies

Badge +1
Hi! This helped me, but only works with the small sized text entry. How can it work with a medium size text entry too?
Userlevel 6
Badge +5
What changed? I actually got it working fine when I moved it to the OnLoad instead of OnReady section
Userlevel 2
Badge +4
> @uhrxx005 said:
> @Alfia, I would also love to do this, but the code doesn't appear to be doing anything when placed into the AddOnReady section. Any ideas how to fix it?

Thanks, I've updated the code, please check..
Userlevel 6
Badge +5
@Alfia, I would also love to do this, but the code doesn't appear to be doing anything when placed into the AddOnReady section. Any ideas how to fix it?

EDIT: It worked under the "OnLoad"
Userlevel 2
Badge +4
Hi @Cathaya,

Use the below code to achieve this. Place the script in Qualtrics.SurveyEngine.addOnReady()

jQuery('input:text').hide();

var rid =jQuery("input[type='text']").parent().parent().find("input[type='radio']").attr("id");

jQuery("[type='radio']").change(function()
{

if(jQuery("[id='"+rid+"']").prop("checked") == true)
{
jQuery("[id*='"+rid+"~TEXT']").show();
}
else
{
jQuery("[id='"+rid+"~TEXT']").val('');
jQuery("[id='"+rid+"~TEXT']").hide();
}

});

Leave a Reply