I'm trying to get the background image of the div and afterwards to change it by adding gray prefix to the bg image name.
Everything is working perfectly in chrome and firefox, but in IE the value of background image is about-blank
. Please help me?
var img= $("#nom_"+$(".nomination").attr('id')).css('background-image');
var image = img.split('/').pop();
var img1 = image.split(')',1);
var img1 = "<|UP>/gray"+img1;
the attr('id') is visible in IE the problem is with .css('background-image')
; but for IE I've changed it to
if($.browser.msie){
var id ="nom_"+$(".nomination").attr('id');
obj=document.getElementById(id);
alert(obj.currentStyle.backgroundImage);
}
but again the returned value is 'about-blank'.
ok man... Now the problem is solved... As the problem was because of style attribute ... When the background image is set by style (inline) the img= $("#nom_"+$(".nomination").attr('id')).css('background-image');
is not working in IE... but We can get it by changing this line with
var img= $("#nom_"+$(".nomination").attr('id')).attr('style');
var image = img.split('/').pop();
var img1 = image.split(')',1);
img1 = "<|UP>/gray"+img1;
in this case it is visible for IE... and I'm able to add prefix to final img1 variable... thanks to everyone... )))