创建一个
当你按 Enter 键时
我制作了一个文本区域表单,您可以在其中更改您的描述,就像我在上一个问题中询问是否有任何方法可以禁止标签。但是现在有什么方法可以让您按 Enter 时在文本区域中设置
以便用户不必输入
每次他们想要换行?
我想到了如果它能找到什么都没有的地方,但这行得通吗?我不熟悉 onpress 事件...或者如果它在用户按下提交后检查输入,然后检查换行符。
我在 YouTube、这个网站和很多其他网站上也看到过这个。
I have made a textarea form where you can change your description and like in my previus question I asked if there was any way of having banned tags. But now is there any way of when you press Enter that a <br />
will be set in the textarea so that the user doesn't have to type in <br />
every time they want a line break?
I thought of something like if it can find places where there's nothing, but would this work? I'm not familiar with onpress events... Or if it checks the input after the user has pressed submit and then it checks for line breaks.
I have seen this on YouTube , this site and a lot of other sites too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在PHP中,可以使用
nl2br()
函数来替换任何带有
标签的换行符。In PHP, you can use the
nl2br()
function to replace any newlines with<br />
tags.您可以这样做:
希望有帮助
You can do this as :
Hope it helps