Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove background color/images for all elements with jQuery

Tags:

html

jquery

css

Is there a simple way to use jQuery to remove all background styles on a page? Specifically, need to remove background color and images.

like image 268
Ian McIntyre Silber Avatar asked Dec 08 '10 04:12

Ian McIntyre Silber


2 Answers

Real simple with jQuery...

$('*').css('background', 'transparent');

jsFiddle.

If you didn't have jQuery at your disposal...

var allElements = document.getElementsByTagName("*");

for (var i = 0, length = allElements.length; i < length; i++) {
    allElements[i].style.background = "none";
}

jsFiddle.

like image 195
alex Avatar answered Nov 15 '22 14:11

alex


$('*').css('background', 'transparent');
like image 25
Sharon Avatar answered Nov 15 '22 16:11

Sharon