开发者

How do I automatically switch focus of input elements on on HTML form?

I have an HTML form with three inputs for phone number input. I want a cursor to move to the next input after the current one is filled.

Like you entered three digits in the first box, and then the cursor moves to the second, and after 开发者_如何学Pythonit is filled, moves to the third.

Is it possible to accomplish this without JavaScript?


I don't condone auto-tabbing, I think it irritates & confuses some users, but here's one way to do it in "Obtrusive JavaScript": http://www.javascriptkit.com/script/script2/autotab.shtml

I'm not a big fan of having 3 inputs for 1 phone number, because then you have to write extra code to combine them. It just seems illogical, inputs & data should have a 1:1 ratio.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜