2016-05-03 1 views
0
$(document).ready(function($) { 
    var now = new Date; 
    $('.code-date').text(function (i, v) { 
     if (now > new Date(v)) { 
      $("#web-btn").text('Register Now'); 
     } 
    }); 
}); 

ので、イベントがアーカイブここjQueryのスクリプトは、Chromeで動作します

に表示するボタンの変更でテキストを起こるフィドルhttps://jsfiddle.net/SCATORY/fs2hom47/

+0

あなたは何が起こるかを見るために、あなたの中のスクリプトを "はconsole.log" を追加する必要があります。.. Wordpressの中にjQueryのために。 – Random

+0

'jQuery'と' $ 'を変更してみてください、' $(ドキュメント)から '' jQueryの(ドキュメント) 'にそうとそう –

+0

@BojanPetkovski :)上しかし、なぜそれがChromeで動作しますが、ではないはずです他の仲間それでは? –

答えて

0
へのリンクだ後、私がやろうとしていることです

ああ、それを見たことはありませんでした。問題はあなたの日付形式です。 new Date(v)を呼び出すとき、vは無効な日付形式であり、日付文字列として受け入れられません。

あなたのdiv .CODE-日の日付は、10-14-15として書かれており、それが無効な日付を表しています。 .news-date Oct 14, 2015にあるようにフォーマットを使用すると、chromeだけでなく、どこでも同じように動作します。

もっとここで読む:ここDate

は実施例である:)

$(document).ready(function($) { 
 
    var now = new Date(); 
 
    $('.code-date').text(function(i, v) { 
 

 
    if (now > new Date(v)) { 
 
     $("#web-btn").text('Register Now'); 
 
    } 
 
    }); 
 
});
<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&nbsp;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&nbsp;this free webinar learn&nbsp;how big data is transforming cardiac research. Presented by&nbsp;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>

+0

上述したように、ええ、それは何が、クロムではなく、他のブラウザでフィドルに動作しますそうだった!巨大な感謝と私はあなたにコーヒーを借りている –

+0

またはあなたは正しいとして彼の答えをマークすることができます:)... – andreivictor

関連する問題