I have a button having the following CSS background rule applied:
background-image:url('/images/button_1_normal.png');
I would like to change the button's background with JavaScript. I tried the following but it didn't work.
document.getElementById(step2).style.backgroundImage = "url('images/button_1_active.png') no-repeat";
What is the problem? Thank you
no-repeat is invalid. Only the URL part is a valid value for the background image property.
Either remove that or change your assignment to background:
document.getElementById(step2)
.style.background="url('images/button_1_active.png') no-repeat";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With