Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove a background-image attribute?

Tags:

I have this code :

if (pansel.val() == "1")       $(#myDiv).css('background-image', 'url(/private_images/guida_check_category.jpg)');  else       $(#myDiv).css({ 'background-color': '#ffffff' }); 

and I see that, when I apply the background-image, the follow code :

$(#myDiv).css({ 'background-color': '#ffffff' }); 

doesnt remove the image and put the white background color. The image still present!

How can I totally remove that background-image attribute?

like image 822
markzzz Avatar asked Jul 19 '11 12:07

markzzz


People also ask

How do I remove a specific background from an image?

Select the picture that you want to remove the background from. On the toolbar, select Picture Format > Remove Background, or Format > Remove Background. If you don't see Remove Background, make sure you have selected a picture.

What is the attribute for image background?

The most common & simple way to add background image is using the background image attribute inside the <body> tag.


1 Answers

Try this:

if (pansel.val() == "1")       $("#myDiv").css('background-image', 'url(/private_images/guida_check_category.jpg)');  else {      $("#myDiv").css({ 'background-color': '#ffffff' });      $("#myDiv").css('background-image', 'none'); } 
like image 87
CdB Avatar answered Sep 20 '22 11:09

CdB