Consider the below code snippet that simply disables all buttons on a webpage:
<script>
var inputs = document.getElementsByTagName('button');
for (var i = 0; i < inputs.length; i++) {
inputs[i].disabled = true;
}
var seconds = 0;
setInterval(calculateSeconds, 1000);
function calculateSeconds()
{
seconds += 1;
if(seconds > 5)
{
var inputs = document.getElementsByTagName("button");
for (var i = 0; i < inputs.length; i++) {
inputs[i].disabled = false;
}
}
}
</script>
Aside from the fact that this is not really a cool, well-written or purposeul piece of code, it should work and it does work on all browsers in Windows Desktop and on Android, except for browsers running in iOS; I tested this on an iPhone using Chrome and Safari and it does not work. I cannot find the cause of this, none of syntax is deprecated or unsupported, according to http://caniuse.com/. It's driving me crazy. No CSS is used on the website I am testing. It doesn't work on <button>
tags, nor on <input type="button">
tags, nor on <input type="submit">
tags.
Does anyone have any tips, resources or pointers to why this is not working on iOS devices?