我有这份文件,例如:
This is the first line
<br>
This is the second line
<br>
This is the third line
现在我想删除<br>
并格式化文字,如下所示
<DIV ID=PAGINATION-CONTENT>
This is the first line
</DIV>
<DIV ID=PAGINATION-CONTENT>
This is the second line
</DIV>
<DIV ID=PAGINATION-CONTENT>
This is the third line
</DIV>
如何通过使用jquery来实现?
答案 0 :(得分:1)
这样的东西?我使用classes
因为ID必须是唯一的!
<p>
This is the first line
<br>
This is the second line
<br>
This is the third line
</p>
var lines = $('p').html().split('<br>')
var divs = '';
$.each(lines, function(i, line) {
divs += '<div class="PAGINATION-CONTENT">'+line+'</div>';
})
$('p').html(divs)
答案 1 :(得分:0)
您可能正在寻找page-break-before
和page-break-after
css规则。
假设您正在谈论实际的分页符(即打印时)。如果没有,那么你的问题就不清楚了。