0

Button color javascript

I use o mouse down to change color button with document.getElementById(“demo”).style.background = “red”; But how I get back it’s original default color with onmouseup?

1st Feb 2020, 9:01 AM
Jorge Muñoz
Jorge Muñoz - avatar
1 RĂ©ponse
+ 5
use css. #demo:active{ background: red; } this way, it'll back to original color
1st Feb 2020, 9:22 AM
Taste
Taste - avatar