views:

6049

answers:

1

Hi,

I have a url in a variable, and I am having issues setting the value in css.

$('myOjbect').css('background-image', imageUrl);

Any pointers?

+15  A: 

You probably want this (to make it like a normal CSS background-image declaration):

$('myOjbect').css('background-image', 'url(' + imageUrl + ')');
Greg