[英]How do I show line breaks in Django template without using the “linebreaksbr” template filter?
Let's say I have this: 假设我有这个:
first \n\n\n second
I want to display that on my page. 我想在我的页面上显示它。 However, I don't want to use linebreaksbr filter because I'm using JQuery jeditable (edit in place).
但是,我不想使用linebreaksbr过滤器,因为我使用的是可编辑的JQuery(就地编辑)。
When I click on my div, it'll turn it into a text are box. 当我单击div时,它将变成文本框。 In this case, it'll be
first<br><br><br> second
在这种情况下,它将是
first<br><br><br> second
I don't want that. 我不要 I want it to turn into a text area box with the line breaks already applied.
我希望它变成一个已经应用了换行符的文本区域框。
You can use the preformatted ( <pre>
) tag. 您可以使用预格式化的(
<pre>
)标签。
Or you can replace the <br>
with \\n
in jQuery while converting it to a textbox. 或者,您也可以在jQuery中将
<br>
替换为\\n
,同时将其转换为文本框。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.