【发布时间】:2014-11-09 20:32:57
【问题描述】:
我有一个 div 元素
<div id="testResult" style="padding-left: 120px;">
我正在尝试在 div 元素内打印一些带有换行符 '\n' 的文本。
但是在我的html 页面中显示的文本忽略了换行符。
$("#testResult").html("Feature: Apply filter to image\n As an user\n I want to be able to apply a filter to my image\n So I can make it look better and match my card's stile\n\n @US2330 @done\n Scenario Outline: Apply filter to a picture # features/card_edit_filter.feature:33\n Given I am on \"Filters Editor\" screen # features/step_definitions/common_steps.rb:1\n And I see my card with the original image # features/step_definitions/card_filter_steps.rb:21\n When I touch the \"<filter_name>\" filter # features/step_definitions/card_filter_steps.rb:1\n Then I see the image with the filter applied # features/step_definitions/card_filter_steps.rb:26\n\n Examples: \n | filter_name |\n | Black & White |\n | Sepia |\n | Vintage |\n\n @US2330 @done\n Scenario: Restore image after applying filter # features/card_edit_filter.feature:47\n")
我想将文本显示为:
Feature: Apply filter to image
As an user
I want to be able to apply a filter to my image
So I can make it look better and match my card's stile
@US2330 @done
Scenario Outline: Apply filter to a picture # features/card_edit_filter.feature:33
Given I am on "Filters Editor" screen # features/step_definitions/common_steps.rb:1
And I see my card with the original image # features/step_definitions/card_filter_steps.rb:21
When I touch the "<filter_name>" filter # features/step_definitions/card_filter_steps.rb:1
Then I see the image with the filter applied # features/step_definitions/card_filter_steps.rb:26
Examples:
| filter_name |
【问题讨论】:
标签: javascript jquery html css