本文介绍了输入值中的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在< input>
值
中添加几行换行符。 & NewLine;
,&#10;
,&#13; &#10;
和 \\\
不起作用。一切仍然在一条线上。
在解决我的问题的其他问题中,我还没有找到对此问题的答案。提前致谢。
解决方案
实际上我不认为你可以为这些类型的表单元素换行。您可能必须使用 < textarea>
标签,以允许文字换行符:
< textarea id =multilinername =multiliner> line1line2line3< / textarea>
I am trying to add a couple of line breaks in an <input>
value
. 

,
,
and \n
aren't working. Everything is still on the one line.
I haven't found an answer to this question amongst other questions that solves my problem. Thanks in advance.
解决方案
I don't actually think you can have line breaks for those types of form elements. You may have to use a <textarea>
tag which allows for literal line breaks:
<textarea id="multiliner" name="multiliner">line1
line2
line3</textarea>
这篇关于输入值中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!