开发者

How to create a Textbox with style that accepts only 2 characters

开发者 https://www.devze.com 2023-02-20 07:56 出处:网络
How do i create a html textbox whichlooks that it can accepts only 2开发者_运维知识库 characters .

How do i create a html textbox which looks that it can accepts only 2开发者_运维知识库 characters .

<input type="text"  maxlength="2" size="1"/>

what style do i need to apply so that textbox can be shown in such way it can accept 2 characters style ="???"


A simple width would do:

<input type="text"  maxlength="2" size="1" class="twochar"/>

And the css:

.twochar
{
    width:2em;
}

http://jsfiddle.net/kjl_42/vstMC/

0

精彩评论

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

关注公众号