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");
});
```
Page 1 / 1
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
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);
});
});
```
```
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.