$(document).ready(function($) {
var now = new Date;
$('.code-date').text(function (i, v) {
if (now > new Date(v)) {
$("#web-btn").text('Register Now');
}
});
});
所以我想要做的是在事件发生后,按钮中的文字变为查看存档
的链接答案 0 :(得分:0)
v
时,10-14-15
是无效的日期格式,不接受为日期字符串。
在div .code-date中,日期写为Oct 14, 2015
,表示无效日期。如果您使用.news-date chrome
中的格式,它将在任何地方都有效,而不仅仅是 $(document).ready(function($) {
var now = new Date();
$('.code-date').text(function(i, v) {
if (now > new Date(v)) {
$("#web-btn").text('Register Now');
}
});
});
。
在此处阅读更多内容:Date
这是一个工作示例:)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="col-md-3">
<h1 class="news-section-title">
<i class="fa fa-desktop fa-lg"></i> Webinars
</h1>
<!-- the loop -->
<article class="news-item">
<span class="news-date">Jun 15, 2016 | 11:00 AM</span>
<h2 class="news-title"><a target="_blank" href="http://xtalks.com/EvriBeat-Dynamic-Electrocardiography.ashx" class="news-link">EvriBeat – Dynamic Electrocardiography <div class="code-date" style="display: none;">Jun 15, 2016</div></a></h2>
<div class="news-excerpt">
<p>BioTelemetry Research’s exclusive offering, EvriBeat, an advanced alternative method to Thorough QT studies for assessing cardiac safety in early human trials.</p>
</div>
<!--1465948800--><a target="_blank" href="http://xtalks.com/EvriBeat-Dynamic-Electrocardiography.ashx" id="web-btn" class="btn btn-primary btn-sm download-link">
View Archive</a>
</article>
<article class="news-item">
<span class="news-date">Oct 14, 2015 | 11:00 AM</span>
<h2 class="news-title"><a target="_blank" href="http://www.xtalks.com/New-Phase-I-Cardiac-Safety-Paradigm.ashx" class="news-link">Dynamic Repolarization Analysis: A New Phase I Cardiac Safety Paradigm<div class="code-date" style="display: none;">Oct 14, 2015</div></a></h2>
<div class="news-excerpt">
<p>BioTelemetry Research is proposing a service offering for evaluation of cardiac repolarization in early human trials, novel to the industry, called Dynamic Repolarization Analysis.</p>
</div>
<!--1444780800--><a target="_blank" href="http://www.xtalks.com/New-Phase-I-Cardiac-Safety-Paradigm.ashx" id="web-btn" class="btn btn-primary btn-sm download-link">
View Archive</a>
</article>
<article class="news-item">
<span class="news-date">Jun 24, 2015 | 11:00 AM</span>
<h2 class="news-title"><a target="_blank" href="http://www.xtalks.com/Medical-Imaging-Oncology-Clinical-Trials.ashx" class="news-link">Medical Imaging: Maximizing Efficacy and Safety in Oncology Clinical Trials<div class="code-date" style="display: none;">Jun 24, 2015</div></a></h2>
<div class="news-excerpt">
<p>In this free webinar, industry experts Sandra Chica, MD and Polina Voloshko, MD aim to describe novel medical imaging approaches and methodologies to help sponsors maximize clinical trial efficiency along the development pathway.</p>
</div>
<!--1435104000--><a target="_blank" href="http://www.xtalks.com/Medical-Imaging-Oncology-Clinical-Trials.ashx" id="web-btn" class="btn btn-primary btn-sm download-link">
View Archive</a>
</article>
<article class="news-item">
<span class="news-date">Apr 28, 2015 | 11:00 AM</span>
<h2 class="news-title"><a target="_blank" href="http://xtalks.com/Evaluation-of-Atrial-Fibrillation.ashx" class="news-link">Evaluation of Atrial Fibrillation and Other Arrhythmias within Clinical Trials and Clinical Practice<div class="code-date" style="display: none;">Apr 28, 2015</div></a></h2>
<div class="news-excerpt">
<p>In this free webinar learn how big data is transforming cardiac research. Presented by Polina Voloshko, MD, Chief Medical Officer, BioTelemetry Research, and Wayne M. Derkac, MD, Vice President of Medical Affairs, BioTelemetry.</p>
</div>
<!--1430179200--><a target="_blank" href="http://xtalks.com/Evaluation-of-Atrial-Fibrillation.ashx" id="web-btn" class="btn btn-primary btn-sm download-link">
View Archive</a>
</article>
<!-- end of the loop -->
</div>
&#13;
<c:if test="${repairPartAddNew.clientReportIssuePart != null}">
<c:set var="loopValue" value="1" scope="page" />
<c:forEach var="issueClient" items="${repairPartAddNew.issueClientList}" varStatus="loop">
<tr>
<td>
<form:select disabled="disabled" multiple="false" id="clientReportIssuePart${loopValue}" class="form-control input-sm" name="clientReportIssuePart" path="clientReportIssuePart"
onchange="getPartSubtypes(this.value,$(this).parent().next().find('select').attr('id'));">
<form:option value="${issueClient.part}">${issueClient.part}</form:option>
<form:options items="${descriptionParts}" itemValue="value" itemLabel="name"/>
</form:select>
</td>
<td>
<form:select disabled="disabled" multiple="false" class="form-control input-sm" id="clientPartType${loopValue}" name="clientPartType" path="clientPartType"
onchange="getRepairPartIssue(this.value,$(this).parent().next().find('select').attr('id'),$(this).parent().prev().find('select').val());">
<form:option value="${issueClient.type}">${issueClient.type}</form:option>
</form:select>
</td>
<td>
<form:select disabled="disabled" multiple="false" class="form-control input-sm" id="clientRepair${loopValue}" name="clientReportIssuePartId" path="clientReportIssuePartId">
<form:option value="${issueClient.id_issue}">${issueClient.issue}</form:option>
</form:select>
</td>
<td class="text-center width-100">
<button type="button" id="deleteClientRowBtn" class="btn btn-outline btn-sm btn-dark"
onclick="deleteRow(this, $(this).closest('table').attr('id'))">Delete Row
</button>
<td class="text-center width-100">
<button type="button" class="btn btn-outline btn-sm btn-dark"
onclick="addTableRow('tableClientTemplate', $(this).closest('table').attr('id'))">Add Row
</button>
</td>
</tr>
<c:set var="loopValue" value="${loopValue + 1}" scope="page"/>
</c:forEach>
</c:if>
</tbody>
&#13;