Javascript output only showing once -
how come can output render javascript once? try show again , doesn't work?
$(function() { $('#access').keyup(function () { var access = $('#access').val(); var note = $('#note'), // notice *1000 @ end - time must in milliseconds ts = (new date(access * 1000)).gettime() + 1 * 24 * 60 * 60 * 1000; $('#countdown').countdown({ timestamp: ts, callback: function(days, hours, minutes, seconds) { var message = ""; message += days + "<small class='white'>d</small>, "; message += hours + "<small class='white'>h</small>, "; message += minutes + "<small class='white'>m</small>, "; message += seconds + "<small class='white'>s</small>"; note.html(message); } }); }); });
then call javascript here , works fine.
pre-sale ends in <span id="note"></span>
but further down page try show again same html code, it's blank on second one. doesn't work!
you using id's in html, can used once per page. switch #note
.note
, #countdown
.countdown
in javascript, , add class 2 elements , show up.
Comments
Post a Comment