Button color javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answer
+ 5
use css. #demo:active{ background: red; } this way, it'll back to original color
1st Feb 2020, 9:22 AM
Taste
Taste - avatar