Need help with countdown component #497
-
Hi guys, Can someone please some a simple example how to change the countdown value? I googled how to change a css variable using js and found these, https://www.w3schools.com/css/css3_variables_javascript.asp I tried to use setInterval and change the --value variable as the links above shows, but I still can get the counter to work. setInterval(() => {
counter.value++
document.documentElement.style.setProperty('--value', counter.value)
console.log(counter.value)
}, 1000) I have never done something like this using js, so I have no clue where the mistake is. Can someone give a help here, thanks. BTW, DaisyUI is freaking awesome, I love it. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Here's an example: https://codepen.io/saadeghi/pen/jOazxMz?editors=1010 |
Beta Was this translation helpful? Give feedback.
-
@saadeghi This is my example, https://codepen.io/michael-indochat/pen/ZEjQvGX?editors=1011 |
Beta Was this translation helpful? Give feedback.
-
How to remove the leading zero at the number? I want to get 1 number, not 01 |
Beta Was this translation helpful? Give feedback.
Here's an example: https://codepen.io/saadeghi/pen/jOazxMz?editors=1010