表单元素输入值中的换行符 [英] line breaks in form element input value

查看:269
本文介绍了表单元素输入值中的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将换行符(也称为换行符)添加到input元素的值. 


 
\n无效;仍然一切都在同一行.

I am trying to add line breaks (aka newlines) to values of the input-element. 
, 
, 
 
 and \n aren't working; still everything is on one line.

除了解决我的问题的其他问题外,我没有找到该问题的答案.预先感谢.

I haven't found an answer to this question amongst other questions that solves my problem. Thanks in advance.

推荐答案

我实际上不认为您可以为这些类型的表单元素设置换行符.您可能必须使用<textarea>标记,该标记允许使用文字换行符:

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>

这篇关于表单元素输入值中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆