+ 1
How change color of <button onclick >?
I have SOME <button> and want to change their color https://code.sololearn.com/WoMjqavLSdr8/?ref=app
4 odpowiedzi
+ 2
Could you describe more? What button do you mean? And which colour do you want to change?
https://www.sololearn.com/discuss/1316935/?ref=app
+ 2
You can do in the onclick attribute:
"minus(this)"
JS:
function minus(obj) {
//code
obj.style.background = "red";
}
(this will change the background permanently)
Or, better, with CSS with active:
button:active {
background: red;
}
(this will only change it while you are clicking on it)
+ 1
Thanks, but something is wrong. It doesn't show this color
0
هاواريو