Trying to focus on a textarea after an ajax call back function using javascript. This works fine in chrome and ie, but not on IOS safari. Up until this scenerio, fucus has worked fine on my IOS phone.
Here's the idea I had that's unsuccessful. The textarea appears, but it doesn't focus after appearing (for my IOS phone only).
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
document.getElementById('test_project').innerHTML=this.responseText;
document.getElementById('textarea_1').focus();
}
}
xmlhttp.open("POST","../ajax/forms.php",true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("phase=test");
Here is the example code from ajax/forms.php
<textarea id='textarea_1' maxlength='23'></textarea>
The recommended link didn't seem to fix my problem, but showed me IOS does have issues with focus. Any other suggestions are appreciated.