i have problem to fetch background url of a div
HTML:
<div id='test'></div>
CSS:
#test { position:absolute; height:55px; width:85px; top:554px; left:197px; background:url('images/1.jpg'); }
when i try to get background image url by using below it displays blank.
alert(document.getElementById("test").style.backgroundImage);
but interestingly it works for following
document.getElementById("test").style.backgroundImage="url('images/1.jpg')";
alert(document.getElementById("test").style.backgroundImage);
Note: No problem with url because image displayed properly