最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - New line in handlebar templates - Stack Overflow

programmeradmin1浏览0评论

Using Handlebar/Mustache, I would like to show the Address as follows (with the new lines):

{{FirstName}}{{LastName}}
{{Address1}}{{Address2}}
{{City}}
{{State}}
{{Zip}}

But the above is always rendered in one line. I tried using \n but it doesn't work. Is it possible to handle new line (\n) in the template?

Using Handlebar/Mustache, I would like to show the Address as follows (with the new lines):

{{FirstName}}{{LastName}}
{{Address1}}{{Address2}}
{{City}}
{{State}}
{{Zip}}

But the above is always rendered in one line. I tried using \n but it doesn't work. Is it possible to handle new line (\n) in the template?

Share Improve this question asked Oct 19, 2012 at 14:52 dotNetNewbiedotNetNewbie 7994 gold badges17 silver badges35 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Add HTML line breaks to your template:

{{FirstName}}{{LastName}}<br/>
{{Address1}}{{Address2}}<br/>
{{City}}<br/>
{{State}}<br/>
{{Zip}}
发布评论

评论列表(0)

  1. 暂无评论