input textfield not get autofocus

Hi,


We have a responsive webpage which works like a live chat. We are trying to achieve autofocus on input text field but it is not working.

All possible solution found has been implemented but none of them worked. Through debugger we are getting focus on the element but keyboard not appears on iOS Device. The keyboard appears only when a text input has been clicked, but whenever "go" or "return" keys clicked, it disappears. We want the keyboard to be open by default all the time until / unless the user clicks on any back event.



Here is the code snippet used:



inputchatvar.focus();

keypressed=false;

$('#inputchat').on('keydown', function(e){

if(e.which == 9) {

e.preventDefault();

e.stopPropagation();

keypressed=true;

onKeyPressed(e,$scope,inputchatvar,spn);

}

});




For Native app or mobile web app of iOS we can make use of keyboarddisplayrequiresuseraction boolean but how can we achieve it in browser as by default it is set to true.

Testing has been made on Chrome Browser as well and it too shows similar behaviour on iOS devices, so this problem is not only for Safari browser.

Also the keyboard works as i expected on below version of iOS but with new updated version it is not working.

Is there a way to get focus on input whenever the input box is generated dynamically?

input textfield not get autofocus
 
 
Q