Automated HTML Focus Acquisition by IOS System


IOS system cannot automatically get HTML focus

// On normal browsers, JavaScript can be used to focus on an input box:
 var elem = document.getElementById(‘inputElementId’);
But on iOS phones, such code doesn’t work at all, only when focus is executed in functions that listen to user-initiated events.

var button = document.getElementById(‘btn’);
var inputElem = document.getElemntById(‘input-elem’);
button.addEventListener(‘click’, function(ev){