html textarea中的newline字符
参考以下问题下的答案 - 什么字符代表文本区域中的新行
尽管在文本区域中输入数据,但文本区域中的换行符应该是 CRLF换行符仅生成 \n,如下面的代码片段所示 -
<textarea id="one" onchange="document.getElementById('contentdiv').innerText=JSON.stringify(document.getElementById('one').value)"></textarea>
<button onclick="document.getElementById('contentdiv').innerText=JSON.stringify(document.getElementById('one').value)">Read Content</button>
<div id="contentdiv"></div>
对于此处看到的更改行为,文本区域的定义标准是否有参考/更改?
With reference to the answers available under following question -
What character represents a new line in a text area
The newline character in a textarea should be CRLF though entering data in a textarea with newline generates only \n as can be seen in the snippet below -
<textarea id="one" onchange="document.getElementById('contentdiv').innerText=JSON.stringify(document.getElementById('one').value)"></textarea>
<button onclick="document.getElementById('contentdiv').innerText=JSON.stringify(document.getElementById('one').value)">Read Content</button>
<div id="contentdiv"></div>
Are there references/changes in the defined standards for the textarea with respect to the changed behavior seen here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提供的链接实际上有一个答案。
您的情况是2号
The link you've provided actually has an answer.
Your case is number 2