106
rated 0 times
[
113]
[
7]
/ answers: 1 / hits: 35893
/ 6 Years ago, sat, february 17, 2018, 12:00:00
I was trying to make the color of the buttons change using onclick and getElementsByClassName and came up with something like this:
HTML:
<button onclick=submitButtonStyle() type=submit class=stylebutton>
Submit </button>
JS:
function submitButtonStyle() {
document.getElementsByClassName(stylebutton).style.backgroundColor = red; }
I would be really grateful if you guys gave me a hint about what is lacking in my code/what I should add etc.
More From » onclick