retrieving background image from div when dynamically set
Posted
by tixrus
on Stack Overflow
See other posts from Stack Overflow
or by tixrus
Published on 2010-05-12T01:36:10Z
Indexed on
2010/05/12
1:44 UTC
Read the original article
Hit count: 352
I am having an issue with setting the background-image of a #x to the background image of #y.
Correct me if I am wrong but I think you would do this in a simple case by saying
$('#x').css('background-image',$('#y').css('background-image'));
The problem is that when y was initially set up, it was set up like this:
<div id='y' style='background-image: url(./randomcolor.php?ibase=<?php echo $entity->name; ?>) ....
So when it does it, it is getting the URL of the generator, and javascript is just regarding that as a string. Do I have to do an ajax get here, or is there some kind of eval I could use.
© Stack Overflow or respective owner