我有一段非常长的HTML代码,用于在您使用旧浏览器时进行警告:
<div class="ie-message" style="display: block; ">
<div class="alert error">
<h2>
Sorry, your web-browser is outdated
</h2>
<p>
We recommend you install new version of web-browser
</p>
</div>
<div class="browsers-list">
<div class="browser-button chrome">
<a href="http://www.google.com/chrome">Google Chrome</a>
</div>
<div class="browser-button firefox">
<a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a>
</div>
<div class="browser-button opera">
<a href="http://www.opera.com/download/">Opera</a>
</div>
<div class="browser-button safari">
<a href="http://www.apple.com/safari/download/">Apple Safari</a>
</div>
<div class="browser-button ie">
<a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer</a>
</div>
</div><div class=?"ie-message" style=?"display:? block;? ">?<div class="ie-message" style="display: block; ">
<div class="alert error">
<h2>
Sorry, your web-browser is outdated
</h2>
<p>
We recommend you install new version of web-browser
</p>
</div>
<div class="browsers-list">
<div class="browser-button chrome">
<a href="http://www.google.com/chrome">Google Chrome</a>
</div>
<div class="browser-button firefox">
<a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a>
</div>
<div class="browser-button opera">
<a href="http://www.opera.com/download/">Opera</a>
</div>
<div class="browser-button safari">
<a href="http://www.apple.com/safari/download/">Apple Safari</a>
</div>
<div class="browser-button ie">
<a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer</a>
</div>
</div>
我该如何使用jQuery附加它?当我将所有内容写在一个字符串中时,我得到了所需的结果。
$('body').append('<div class="ie-message" style="display: block; "><div class="alert error"><h2>Sorry, your web-browser is outdated</h2><p>We recommend you install new version of web-browser</p></div><div class="browsers-list"><div class="browser-button chrome"><a href="http://www.google.com/chrome">Google Chrome</a></div><div class="browser-button firefox"><a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a></div><div class="browser-button opera"><a href="http://www.opera.com/download/">Opera</a></div><div class="browser-button safari"><a href="http://www.apple.com/safari/download/">Apple Safari</a></div><div class="browser-button ie"><a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer</a></div></div><div class="close-text">close</div></div>');
但是如何使每个HTML标签都在新行上呢?