Allow particiapnts to type without needing to click in text box | XM Community
Skip to main content

I have been creating a cued-recall task. Participants will learn word pairs and during the final test they will be presented with the first word and asked to retrieve the second.

As I go through the preview, I keep having to click in the textbox before I can type my answer.

I would like to be able to type automatically without needing to click first.

 

I have tried various versions of:

Qualtrics.SurveyEngine.addOnReady(function()
{
$('NextButton').hide();
if($('PreviousButton')) $('PreviousButton').hide();
var inputText = $(this.questionId).down('.InputText');
var evt = inputText.on('keydown', function(e) {
if(e.which == 13) {
evt.stop();
$('NextButton').click();
}
});
inputText.activate();
});

 and

Qualtrics.SurveyEngine.addOnload(function() {
$(this.questionId).down('.InputText').focus().defer();
});

These were suggestions I had seen in other threads, but nothing seems to be working.

Thanks in advance!

Hi @arobey 

Try use this code 

Qualtrics.SurveyEngine.addOnload(function() {

var inputText = $(this.questionId).down('.InputText');

    inputText.focus();

 

});


Unfortunately no change.

Here are some additional details.

This block only has 2 questions, the Text Entry question and a Timing question that states to proceed after 5 seconds. I have been putting the code in the JavaScript for the Text Entry question.

 

I tried removing the Timing question to see if that was making a difference, but no change.

 


New update!

Your suggestion did work!

The issue was caused by “simple layout”.

I turned that off and went back to “classic layout” and now it is working perfectly.

Thank you!!


Hi @arobey 

Great.. Glad to know the solution worked at the end.


Leave a Reply