Hello all,
I currently have a question with two choices. If choice one gets selected, a text box appears. If choice 2 gets selected, no text box appears. I want the text box to clear the answer typed in the first choice if a participant were to change their mind and then select choice 2 after having already typed something in the text box for choice 1.
Will that be possible with the current javascript I am using for this question?
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('input:text').hide();
jQuery("ytype='radio']").change(function(){
if(jQuery(this).prop("checked") == true){
var v1 = jQuery(this).attr("id");
jQuery("id*='"+v1+"~TEXT']").show();
jQuery("rid*='"+v1+"~TEXT']").attr("placeholder", " ");
jQuery(""id*='"+v1+"~TEXT']").css('width',500);
jQuery("wtype='text']").not("id*='"+v1+"~TEXT']").hide();
}else{
var v1 = jQuery(this).attr("id");
jQuery("vid*='"+v1+"~TEXT']").val(' ');
jQuery("id*='"+v1+"~TEXT']").hide();
}
});
});
Page 1 / 1
Change the line above else as below:
jQuery(""type='text']").not(""id*='"+v1+"~TEXT']").hide().val('');
That worked!!!! Thank you so much rondev!!!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.