I'm trying to create a textbox entry field and would like the text on the screen to be masked (with ** or ---- for example), but to have the actual text typed by the respondent recorded. If possible, it would be great to be able to have the respondent type this info, see the * but also have a way to toggle to "show" them the text prior to hitting submit or moving to the next question.
Is this possible, and if so, can anyone supply the accompanying code?
Page 1 / 1
Hello @smdebb ,
Here is the basic code for this:
Paste the below code in the TextEntry question type js(OnReady)
var that=this.questionId;
jQuery("#"+this.questionId+" .InputText").attr("type","password");
var button="<input type='button' id='bid' value='show' / >";
jQuery(button).insertAfter(".InputText");
jQuery("#bid").on('click',function(){
if(jQuery(this).val()=="show"){jQuery(this).val("hide");jQuery("#"+that+" .InputText").attr("type","text");}
else{jQuery(this).val("show");jQuery("#"+that+" .InputText").attr("type","password");}
});
Here is the basic code for this:
Paste the below code in the TextEntry question type js(OnReady)
var that=this.questionId;
jQuery("#"+this.questionId+" .InputText").attr("type","password");
var button="<input type='button' id='bid' value='show' / >";
jQuery(button).insertAfter(".InputText");
jQuery("#bid").on('click',function(){
if(jQuery(this).val()=="show"){jQuery(this).val("hide");jQuery("#"+that+" .InputText").attr("type","text");}
else{jQuery(this).val("show");jQuery("#"+that+" .InputText").attr("type","password");}
});
Thanks for your help @Shashi! If I can inquire further.... I added the JS to the survey item, which is an open ended question (text box response). There is a toggle button for show/hide, but it doesn't seem to toggle between shown vs. hidden text. I am not even a novice in JS so I can't speak to what is wrong.
Thanks!
Thanks!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.