【发布时间】:2019-12-04 22:04:27
【问题描述】:
在 sweetalert 中,我更喜欢使用 html: 而不是通常的 Sweetalert 链接多个字段。主要原因:有时在链接输入时,小屏幕上的响应会变得混乱。
无论如何,我的问题是在sweetalert 的html: 选项中,我不能让html 字符串包含换行符。我会简单地做一个 php include 来包含一大块 HTML
例如在 sweetalert 中:以下是有效的
html:'<h1>hello user</h1> WElcome ..blah blah blah',
但这是无效的:
html:'<h1>hello user</h1>
WElcome ..blah blah blah',
请问如何完成上面的第二部分?
我意识到这可能是一个愚蠢的 JavaScript 新手问题,但请多多包涵
谢谢
拉詹
【问题讨论】:
-
html: '<h1>hello user</h1> ' + 'WElcome ..blah blah blah'然后您可以在+之后将其拆分为不同的行 -
在现代浏览器中,您可以使用 html: `asd...`(反引号)来表示多行字符串
标签: javascript sweetalert