【发布时间】:2014-10-01 03:33:53
【问题描述】:
我想用 <br /> 标签替换 dateTime 渲染文本上的空格。
我编写的代码会这样做,但由于某种原因,我的所有日期都变成了相同的日期。我不知道为什么会这样。
本网站托管的平台是 Adobe Business Catalyst。
html:
<div class="panel callout radius columns small-12 medium-6 large-4 {tag_event month}" data-event-date="{tag_event date (for sorting)}">
<div class="dateNumber" data-bc-date="format:MMM DD">{tag_event date (for sorting)}</div>
<span><a href="{tag_itemurl_nolink}">{tag_short title}</a></span>
</div>
jQuery:
// If I run this, it will change all the rendered dates into Aug 7
$(".callout").each(function(){
$(".dateNumber").html($(".dateNumber").html().replace(' ', '<br />'));
});
【问题讨论】:
-
执行
forEach,其中replace,.html()将获得第一场比赛的HTML -
@PaulS。你能给我一个例子来说明你的意思吗?谢谢。
标签: javascript jquery datetime business-catalyst