Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SetFocus does not work on iPad

We found that this code works on a PC with: IE, Safari and FireFox. However on an iPad or iPhone with Safari it does not auto focus on a textbox. We cannot touch the screen and click the textbox, we need the auto focus. Any tips here?

thanks!

<script language='JavaScript'>
<!--
function SetFocus()
{
    document.form1['txtCode'].focus();
}
window.onload = SetFocus;
// -->
</script>
like image 792
aron Avatar asked Feb 25 '26 16:02

aron


1 Answers

Unfortunately, it appears Mobile Safari does not support this behaviour, by design.

http://www.quora.com/Mobile-Safari-iPhone-or-iPad-with-JavaScript-how-can-I-launch-the-on-screen-keyboard

like image 56
Jason Kealey Avatar answered Feb 27 '26 05:02

Jason Kealey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!