【发布时间】:2016-07-08 15:03:59
【问题描述】:
我的验证摘要有时在末尾有多个 br 标签,如下所示:
<div id="ValidationSummary1" class="alert alert-error">
Last 4-digits of Social Security number does not match
the Member record on file for the Member ID number you
have entered.<br />
Date of Birth does not match the Member record on file for the Member ID
number you have entered.<br /><br />
</div>
我试图在任何时候找到两个背靠背的br 标签并将其替换为如下所示:
$('#ValidationSummary1').replace('<br /><br />', '<br />');
我知道没有replace() 函数。像这样简单的东西有什么替代品?
【问题讨论】:
-
试试这个:
$('#ValidationSummary1').replace('<br /><br />', '<br />'); -
@Asdfg - jQuery 本身没有 .replace() 函数,这就是我发布问题的原因。
标签: jquery