开发者

input length = value length & expands automatically according to value length

开发者 https://www.devze.com 2023-01-09 17:07 出处:网络
I want开发者_如何转开发value length to be the same length as input field and expand automatically. When i write in some text it always has right or left free space. I don\'t want to define input size,

I want开发者_如何转开发 value length to be the same length as input field and expand automatically. When i write in some text it always has right or left free space. I don't want to define input size, i just want it to be the size of the text.

Can this be done ?


You have to use javascript for doing this. Using pure HTML this can't be done. On change event of the text field, you can find the length of the text and the width/size and resize accordingly. Here is sample code.

0

精彩评论

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