In previous articles I explained jQuery Change background color of div, jQuery fadein fadeout effect, jQuery get current page url and title, jQuery create rounded corners for textbox and many articles relating to JavaScript, jQuery, asp.net. Now I will explain how automatically (Auto Tab) send the user from one field (textbox) to the next when the maxlength of the field has been reached.
<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>
|
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
5 comments :
Simple...;-)
Nice
Sir How to achieve this for server controls?
superb
is it possible with Dropdownlist ?????