主电话号码与三个文本字段 [英] primary telephone number with three text field

查看:148
本文介绍了主电话号码与三个文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建以下内容:

我做了如下:

<span>* Primary Phone:</span>
        <input name="prim1" type="text" id="prim1" class="required">
        <input name="prim2" type="text" id="prim2" class="required">
        <input name="prim3" type="text" id="prim3" class="required">

但我得到:

我想要文本通过指定宽度减小,但它不这样做。我还需要一种方法来使用jQuery做这个验证,如果它是一个单独的文本字段,我该怎么做?

I'd like to make the text smaller by specifying the width however it doesn't do that. I also need a way to do the validation for this using jQuery, how can I do it if it's a separate text field?

推荐答案

我不建议只是设置所有必填字段的宽度,我相信你需要更新你的HTML以更好地反映你试图传达,我不一定在CSS中这样做,因为这是数据应该即使没有造型。我会做如下:

I wouldn't recommend just setting the width on all required fields, I believe you need to update your html to better reflect what you are trying to convey and I wouldn't necessarily do it in the CSS as this is data that should be present even without styling. I would do something like:

<span>* Primary Phone:</span>
<input name="prim1" type="text" id="prim1" size="3" class="required">
<input name="prim2" type="text" id="prim2" size="3" class="required">
<input name="prim3" type="text" id="prim3" size="4" class="required">

查看为什么在字体大小通常不可以的情况下输入大小是可以接受的。

Take a look at this for why input size would be acceptable where font size typically isn't.

更多关于验证和防止无效字符,我会使用 JQuery验证或自动标签(如http://www.mathachew.com/sandbox/jquery-autotab/ )。

For more on validation and preventing invalid characters, I would use JQuery Validation or an Autotabber (like http://www.mathachew.com/sandbox/jquery-autotab/) with masking built in.

这篇关于主电话号码与三个文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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