Created
March 12, 2024 21:48
-
-
Save dejurin/d5c5deaf127ddb595e0a3c28907cbe0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://jsfiddle.net/v8Lxazhr/ | |
function changeValue(isIncreasing) { | |
const valueElement = document.getElementById('valueElement'); | |
let currentValue = parseInt(valueElement.innerText); | |
if (isIncreasing) { | |
currentValue++; | |
valueElement.style.color = 'green'; | |
} else { | |
currentValue--; | |
valueElement.style.color = 'red'; | |
} | |
valueElement.innerText = currentValue; | |
setTimeout(() => { | |
valueElement.style.color = ''; | |
}, 500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment