Making mobile keyboard appear on question load | XM Community

Making mobile keyboard appear on question load

  • 17 August 2018
  • 2 replies
  • 17 views

How do I make the mobile keyboard appear automatically as soon as the question loads up? I have a text field, whose ID I grab and try to trigger a focus on.

Below is my code:
```
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
var qidstr = this.questionId;
var responseTextField = document.getElementById('QR~' + qidstr);
jQuery(responseTextField).trigger("focus");

});
```

2 replies

Hello @welork ,

The above code will only work if the event is within the user context (click, mouseup, mousedown ) i.e the user actually need to do those event

In mobile we can't automate the keyboard to appear due to usability issue that the keyboard should not be allowed to be triggered except by user input
Actually, that's not true. I found the following code and it did work for Android, but it wouldn't for iPhones
```
jQuery(document).on("pageshow", "#loginDialog", function () {
// When entering loginDialog
jQuery("label:first").click();
});
jQuery(function () {
jQuery("#startBtn").click(function () {
jQuery.mobile.changePage('#loginDialog', 'pop', true, true);
});
});
```

Leave a Reply