So far I have this as a sort of module on my website, with everything except the word "remaining" coded to "hide" when the "start cycle" button is pressed.
When the button is pressed, I want a timer to pop up counting down from 1 hour in minutes and seconds, with the word "remaining" showing underneath.
I created a countdown timer as a variable as below:
var totalSeconds = 3600; var hours = Math.floor(totalSeconds / 3600 ); var minutes = Math.floor(totalSeconds % 3600 / 60); var seconds = totalSeconds % 60; var result = [hours, minutes, seconds].join(':'); console.log("%c result", "color:black; font-size: 2em; font-family: Arial; font-style: bold; text-align: center; position: absolute; left: 150px; top: 350px", );
This is the show/hide code:
export function button2_click(event) { $w('#text22').hide(); $w('#dropdown2').hide(); $w('#text23').hide(); $w('#dropdown1').hide(); $w('#text31').show(); $w('#result').show(); }
I'm getting an error that "result is not a valid selector", but I'm not sure how to fix this. Can anyone help? Thanks!
Hey
I just created a countdown working in Wix Code in this post. Please take the code from that and use it.
https://www.wix.com/code/home/forum/community-discussion/countdown-timer-1