Home >
Article > Web Front-end > Method to make an input text box change the length according to the content_HTML/Xhtml_Web page production
Method to make an input text box change the length according to the content_HTML/Xhtml_Web page production
WBOYOriginal
2016-05-16 16:38:091831browse
First:
Copy code
The code is as follows:
The size="4" is to define the initial size. If it is not defined here, then change the 4 in this.size=(this.value.length>4?this.value.length:4); into 20, the default size of is 20
Second: If you define the width attribute in the style, let its width change according to the content , aren’t the two requirements contradictory? So the width attribute cannot be defined in style here.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn