Javascript autotab function not working on iPad or iPhone [migrated]
- by freddy6
I have this this piece of html code:
<form name="postcode" method="post" onsubmit="return OnSubmitForm();">
<input class="postcode" maxlength="1" size="1" name="c" onKeyup="autotab(this, document.postcode.o)" />
<input class="postcode" maxlength="1" size="1" name="o" onKeyup="autotab(this, document.postcode.d)" />
<input class="postcode" maxlength="1" size="1" name="d" onKeyup="autotab(this, document.postcode.e)" />
<input class="postcode" maxlength="1" size="1" name="e" /> <br />
</form>
which uses this javascript:
<script>
/*
Auto tabbing script- By JavaScriptKit.com
http://www.javascriptkit.com
This credit MUST stay intact for use
*/
function autotab(original,destination){
if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
destination.focus()
}
</script><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script src="js/scripts.js" type="text/javascript"></script>
<script type="text/javascript">
function OnSubmitForm()
{
if(document.postcode.operation[0].checked == true)
{
document.postcode.action ="plans.php";
}
else
if(document.postcode.operation[1].checked == true)
{
document.postcode.action ="plans_gas.php";
}
else
if(document.postcode.operation[2].checked == true)
{
document.postcode.action ="plans_duel.php";
}
return true;
}
</script>
As soon a you enter in one character into one of the text boxes it automatically tabs across the the next text box.
This works fine on a pc or mac and on safari and also in all other browsers. But when viewing the webpage on an iPad or iPhone (using safari) the auto tabbing function does not work.
Any ideas on how to make the auto tab work on these mobile devices?