文本框长度达到最大后,切换到下一个控件 [英] Switch to next control once textbox length attains maximum

查看:106
本文介绍了文本框长度达到最大后,切换到下一个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我放置了三个文本框,例如:text1,text2,text3

每个文本框的maxlength属性均为3,

我想要的是,当我在text1中输入3个字符时,它应该自动切换到text2.

从text2到text3同样.

我不知道如何在MVC中的HTML中实现.

任何帮助将不胜感激

在此先感谢

Hi Friends,

I have place three text boxes, for ex: text1,text2,text3

every text boxes has maxlength property as 3,

What i want is, when i enter 3 characters in the text1, it should switch to the text2 automatically.

Similarly from text2 to text3.

I don''t how to implement in HTML in MVC.

Any Help will be appreciated

Thanks in advance

推荐答案

MVC确实无关紧要,您可以使用javascript做到这一点.输入控件上有一个onkeyup事件,您可以使用它来检查输入的长度.我会编写一个方法,该方法带有一个文本框和要转到下一步的控件的名称,然后您可以编写代码来检查长度并将焦点设置为3时传递的id.
MVC is irrelevant really, you do this with javascript. There''s a onkeyup event on the input control, you can use that to check the length of input. I''d write a method that takes a textbox and the name of the control to go to next, then you can write code that checks the length and sets the focus to the id passed in when it is 3.


这篇关于文本框长度达到最大后,切换到下一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆