Set Countdown using Javascript

Get help with using Metro 4 components
Post Reply
Kathi90
Posts: 2
Joined: Thu Jan 17, 2019 12:05 pm
Status: Offline

Set Countdown using Javascript

Post by Kathi90 » Thu Jan 17, 2019 12:25 pm

Hello everybody,
It is possible to set countdown using JavaScript?
I have tried several ways to manipulate the countdown non of them worked.

Code: Select all

  ....
<div class="cell-4">
   <div id="countdown_methods" data-role="countdown"></div>
</div>
<button class="button" onclick="setCountDown();">Click Me!</button>
 ...
function setCountdown(val) {
   $('#countdown_methods').attr('data-minutes', "174")
   $('#countdown_methods').data('countdown').start()
}
 ...
results in: undefined

The background is I want to set the countdown using a time-picker. I do not know if it is possible at all to set the countdown like this, I would also be happy about alternatives.

--Kathi

User avatar
olton
Site Admin
Posts: 196
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Jan 17, 2019 2:52 pm

Currently, you can't setup countdown at runtime

Kathi90
Posts: 2
Joined: Thu Jan 17, 2019 12:05 pm
Status: Offline

Post by Kathi90 » Thu Jan 17, 2019 3:03 pm

Thanks, I thought so.

User avatar
olton
Site Admin
Posts: 196
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Jan 17, 2019 4:06 pm

But you can create countdown on the fly with javascript https://sandbox.org.ua/olton/code/6z3w4prwgP

Post Reply