input标签改变高度的同时如何使光标定位在左上角(不使用textarea)

53 阅读1分钟

"```html

Input Cursor Position input { height: 100px; font-size: 16px; padding: 10px; box-sizing: border-box; }
input.style.height = 'auto';
input.style.height = (input.scrollHeight) + 'px';

input.setSelectionRange(startPos, endPos);

}

```"