C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
JavaScript Automatically Move Cursor to Next Field When Textbox Full
WhatsApp
Pintoo Yadav
Aug 13
2015
24.2
k
0
1
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
>
JavaScript to automatically move from one field to another field
</
title
>
<
script
type
=
"text/javascript"
>
function movetoNext(current, nextFieldID) {
if (current.value.length
>
= current.maxLength) {
document.getElementById(nextFieldID).focus();
}
}
</
script
>
</
head
>
<
body
>
<
b
>
Enter your Text:
</
b
>
<
input
type
=
"text"
id
=
"first"
size
=
"4"
onkeyup
=
"movetoNext(this, 'second')"
maxlength
=
"3"
/>
<
input
type
=
"text"
id
=
"second"
size
=
"4"
onkeyup
=
"movetoNext(this, 'third')"
maxlength
=
"3"
/>
<
input
type
=
"text"
id
=
"third"
size
=
"5"
maxlength
=
"4"
/>
</
body
>
</
html
>
JavaScript
move cursor
textbox full
Up Next
JavaScript Automatically Move Cursor to Next Field When Textbox Full