Monday, 29 April 2013

Automatically Move Cursor to Next Field When Textbox Full using javascript in asp.net

JavaScript-
 
<script type="text/javascript">
function movetoNext(current, nextFieldID) {
if (current.value.length >= current.maxLength) {
document.getElementById(nextFieldID).focus();
}
}
</script>


html-

<input type="text" id="txtFirst" size="4" onkeyup="movetoNext(this, 'txtSecond')" maxlength="10" />
<input type="text" id="txtSecond" size="4" onkeyup="movetoNext(this, 'txtThird')" maxlength="10" />
<input type="text" id="txtThird" size="5" maxlength="11" />

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...