First: Copy code The code is as follows:<input type="text" onkeydown="this.onkeyup();" onkeyup="this.size=(this.value.length>4?this.value.length:4);" size="4"> Among them, size="4" defines the initial size. If it is not defined here, change the 4 in this.size=(this.value.length>4?this.value.length:4); to 20. The default size of <input type="text"> is 20. second: If you define the width attribute in style, and want its width to change according to the content, aren't the two requirements contradictory? So here you can't define the width attribute in style. |
<<: SQL implementation of LeetCode (181. Employees earn more than managers)
>>: Vue+SSM realizes the preview effect of picture upload
Table of contents Chain calls A small case Chain ...
Table of contents What is native JavaScript A. Ch...
version: centos==7.2 jdk==1.8 confluence==6.15.4 ...
In fact, we wonder every day when IE6 will really...
Table of contents Why choose react-beautiful-dnd ...
This article shares the specific code of js to re...
HTML is a hybrid language used for publishing on ...
Record lock locks a single index record. Record l...
Samba Overview Samba is a free software that impl...
Several common paging methods: 1. Escalator metho...
We, humble coders, still have to sing, "You ...
The effect shows that two browsers simulate each ...
need Recently, we need to migrate Node online ser...
Preface: As far as I know, currently CSS can only...
Table of contents MySQL result sorting - Aggregat...