place cursor in text box | XM Community
Skip to main content

Hi

For my Qualtrics survey, I need the cursor to automatically appear in the text boxes of my questions. Since I am not a programmer, I have no idea how to code this in javascript. In the thread below, I found the following code:   

$(this.questionId).down('.InputText').focus().defer();

I added this line of code to the addOnReady section, but it doesn’t work at all.

I also tried the following code, but it doesn’t work either:

inputText.activate();

Could someone help me by giving me a line of code that I can directly paste into the questions? I would need this to work in all browsers (some people reported having trouble implenting this in some browsers but not in others).

Thanks!

 

Hey @GlennDM 

You want the person to be able to type right away? I'm confused because of the word cursor. If you want them to be able to type immediately, you can use this code:

You only need to chance the QID1 to your own question ID

Qualtrics.SurveyEngine.addOnReady(function() {

    // Replace 'QID1' with the actual question ID where you want to set focus

    var questionId = 'QID1'; 

    

    jQuery('#' + questionId + ' .InputText').eq(0).focus();

});

 

 


Hey @GlennDM 

You want the person to be able to type right away? I'm confused because of the word cursor. If you want them to be able to type immediately, you can use this code:

You only need to chance the QID1 to your own question ID

Qualtrics.SurveyEngine.addOnReady(function() {     // Replace 'QID1' with the actual question ID where you want to set focus     var questionId = 'QID1';           jQuery('#' + questionId + ' .InputText').eq(0).focus(); });
 

 

Hi @RickB,

Amazing, thanks this works perfectly!

 

 


Leave a Reply