1

I'm trying to change the css background style in JavaScript. I'm able to do this

div.style.backgroundImage = "url('img/bg1.png')";

but when I try to add these styles it doesn't work - it returns with this error

Uncaught SyntaxError: Unexpected token - (index):59

div.style.-webkit-background-size = cover;
div.style.-moz-background-size = cover;
div.style.-o-background-size = cover;
div.style.background-size = cover;

is it possible to do this in JavaScript?

Brian Burns
  • 20,575
  • 8
  • 83
  • 77
Nik Hendricks
  • 244
  • 2
  • 6
  • 29

0 Answers0