Stack Exchange
How to Auto Tab(Cursor) in Html.TextBoxFor(or Html.TextBox)?
I'm new in ASP.NET MVC 4, and I have any questions
I have 5 Textbox following This Picture(Link).
https://i.stack.imgur.com/hMjJp.png
in each textbox I set maxlength for its. Following This Picture(Link)
https://i.stack.imgur.com/rSi4U.png
Example : textbox1 -> maxlength = 1
          textbox2 -> maxlength = 4
          textbox3 -> maxlength = 5

I want to auto tab when i insert data to each textbox.
Example : when I insert "1" to textbox1(maxlength=1) cursor will go to textbox2 AUTO

And thereafter I want to set data as All textbox
Example : string value = textbox1 + textbox2 + ... + textbox5
        value = 1222233333...  

Please accept my sincere apology in advance for any mistake that may occur.
Thank You Very Much.

Something like following should work,
markup
<div class="tax">
    <input type="text" maxlength="1" />
    <input type="text" maxlength="4" />
    <input type="text" maxlength="5" />
    <input type="text" maxlength="2" />
    <input type="text" maxlength="1" />
</div>

script
$(function () {
    $('.tax input[type="text"]').keypress(function (e) {
        if (e.which == 0 || e.charCode == 0) {
            return true;
        }
        var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
        str = $(this).val() + str;

        if (str.length == $(this).prop('maxlength')) {
            var that = this;
            window.setTimeout(function(){
                $(that).next('input[type="text"]').focus();
            }, 0);
        }
    });
});

fiddle: http://jsfiddle.net/tkasD/5/
hope this helps.

Thank you for answer.
So I'm new in MVC and Javascript.
I don't know how to Declare Javascript(your code : $(function () { )
How to Declare its. (in View, Controller or etc.)

check out http://stackoverflow.com/questions/10399122/how-to-organize-the-javascript-code-in-asp-net-mvc-applications for managing js in mvc application

Thank you very muchhhhhh!
Now I can Resolve this problem.
Thank you for Help me.
