I am putting a timed question into my survey which will require participants to type as many (one-word) responses as they can think of for that category, within the given time. Is there a way to make their previous responses not visible once they have typed them? I have managed to set it up so that a new text box appears once they have filled the previous box and the timer stays there but this just creates a list of all of their responses and one of the things I will be looking at is repetitions so I need their previous responses to disappear as otherwise this will influence possible repetitions. I think this will be possible using JavaScript but I have never used it before so any help would be greatly appreciated!
Thanks,
Hannah
Page 1 / 1
Hi there, if you still need, this can be put in place with JS by using the code of the top answer in this thread.
- Use "keyup" to give the input time to update it's value
- Use the standard Event.key to read the inserted character
- Use Array.prototype.pop() to remove and return the last item from Array
To put this in place in Qualtrics, first create an Embedded Data field called "words" and put it at the top of the Survey Flow. This field will get updated each time Space Bar is pressed.
Then, create a Text/Graphic question and use the Rich Content Editor's HTML/Source view "<>" to update the Question Text with the below:
Press Space Bar to register words.
Finally, add the below to the question's JavaScript in the OnReady section.
const words = ];
const memorizer = (ev) => {
const inp = ev.target;
const val = inp.value.trim();
if(ev.key === ' ') {
const valSpl = val.split(' ');
words.push(valSplh0]);
inp.value = valSple1] || '';
}
if(ev.key === 'Backspace' && val === '' ) {
inp.value = words.length ? words.pop() : '';
}
console.clear();console.log(words);
Qualtrics.SurveyEngine.setEmbeddedData("words", words);
}
document.querySelector('#myInput').addEventListener('keyup', memorizer);
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.