Hello guys,
I have a series of divs (all with the same CSS class) and I'm trying
to add dynamically a background image to each one (each div needs a
different image) so here my code

$('.panel').css({'background-image' : 'url(../images/sub/'+ $
(this).attr("id") +'.png)'});

but unfortunately my divs don't have any background; however if I
hardcode a image, for instance

$('.panel').css({'background-image' : 'url(../images/sub/bg1.png)'});

every div has the (same) background.

Finally if I print out the image path for each div

 $('.panel').each(function(){
alert('url(../images/sub/'+ $(this).attr("id") +'.png)'});
});

the path looks fine.


Am I missing something???

THANKS

Sig

Reply via email to