使用jQuery的输入字段文本换行

Input Field text wrap with jQuery

本文关键字:文本 换行 字段 输入 jQuery 使用      更新时间:2023-09-26

我正在创建一个输入字段,以便为访问者提供如何继续操作的说明。一旦单击,说明将自动隐藏。我可以做,但我发现长句没有正确显示。我试着用css包装代码,但没有成功。

以下是代码:

.replybox{}
.reply-control{
border:1px solid #ccc;
background: transparent;
font-size:20px;
width:100%;
height:100px;
color:#8d8d8d;}
<input class="reply-control" name="replybox" onblur="if (this.value == &quot;&quot;) {this.value = &quot;How to wrap this text? It is hiding the overflown text. I am not finding any way. Please help&quot;;}" onfocus="if (this.value == &quot;How to wrap this text? It is hiding the overflown text. I am not finding any way. Please help&quot;) {this.value = &quot;&quot;;}" value="How to wrap this text? It is hiding the overflown text. I am not finding any way. Please help" type="text"/>

此处为JSFiddle

<textarea type="text" placeholder="Update details of your present skin condition (e.g. normal, dry, flaky, etc). Optionally, add details of any past skin conditions, medication or skin treatments/surgeries undergone. You may also upload images/reports, so that doctors understand your condition better." value=""></textarea>