I'm trying to set focus on a textbox in jQuery mobile. But it is not working. this is my code
<script type="text/javascript">
function FocusOnInput()
{
document.getElementById("username").focus();
}
</script>
and this is my text box.
<input name="username" id="textinput5" type="text">
You're using document.getElementById("username")
when the ID is actually textinput5
.
document.getElementById("username").focus();
should be document.getElementById("textinput5").focus();