On Safari on iOS 9, if you put an event handler on keypress on an input field, and put a setTimeout() function in that, the value property on the input element is not updated before the function in the setTimeout() executes.
The other issue is that the amount of time after the user types in the input field and the DOM is updated is inconsistent.
This behavior is not consistent with any other browser, mobile or otherwise, and it is not present in Safari on iOS 8.
Below is a simple HTML page that demonstrates the problem when it's viewed on Safari on iOS 9.
If you crank up the setTimeout delay to like 10ms it works, but this isn't necessary on any other browser.
<html>
<head>
</head>
<body>
<div>Type here:</div>
<input id="textInput">
<br>
<label for="textOutput">Value of the text field:</label>
<div id="textOutput"></div>
<script>
var textIn = document.getElementById("textInput");
var textOut = document.getElementById("textOutput");
textIn.addEventListener("keypress",
function(){
setTimeout(
function(){
textOut.innerHTML=textIn.value;
}, 0)
})
</script>
</body>
</html>