I have a basic test page:
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous">></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-2">
<p>Test</p>
<form name="scan">
Field 1
<br>
<input type="text" name="first" id="first">
<br>
Field 2
<br>
<input type="text" name="second">
<br>
Field 3
<br>
<input type="text" name="third">
<br>
<br>
<input type="submit" name="submit">
</form>
</div>
<script>
$( document ).ready(function() {
$("input:text:visible:first").focus();
});
</script>
</body>
</html>
It works as expected in all Windows browsers.
The Jquery code does not work when loaded into Safari or Chrome on an iPhone with the latest iOS.
I also tried:
document.getElementById("first").focus();
I also put some alerts around the commands and the alerts worked but the focus did not happen into the first field.
Where am I going wrong?
Thanks
Ken