简体   繁体   English

如何添加换行符

[英]How to add a line break

I'm not good at jQuery at all so please someone help me. 我根本不擅长jQuery,所以请有人帮助我。 I need to add a line break between the name and the email address. 我需要在名称和电子邮件地址之间添加一个换行符。

Right now, the output is: 现在,输出为:

Messages hello@hello.net. 消息hello@hello.net。

I need it to be: 我需要它是:

Messages 留言内容
hello@hello.net hello@hello.net

Here's the code 这是代码

var tabs = [
new Tab({
    name: "tab1",
    text: "Messages hello@hello.net"
})
]

Use \\n to create a new line 使用\\ n创建新行

var tabs = [
new Tab({
    name: "tab1",
    text: "Messages\nhello@hello.net"
})]

Is the 'text' going to be displayed in HTML? “文本”是否将以HTML显示?

Maybe adding a br-tag would do the trick for you. 也许添加br-tag将为您解决问题。

var tabs = [
new Tab({
    name: "tab1",
    text: "Messages<br/>hello@hello.net"
})]

A nicer way might be splitting the text in separate parts, this way its more flexibel for styling etc.: 更好的方法可能是将文本拆分为单独的部分,这样可以更加灵活地设置样式等:

var tabs = [
new Tab({
    name: "tab1",
    prefix: "Messages",
    text: "hello@hello.net"
})]

This is only possible if you have control over whats going on in 'Tab'. 仅当您可以控制“制表符”中的操作时才有可能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM