I have a list of class names. I want to know which class has background image. how can I do that using javascript.
Suppose I have classes in css
.class1 {
background-image = url("someurl");
some attributes
}
.class2 {
some attributes
}
I have only array of class name
arr = ["class1", "class2"]
Here is code what I am doing in javascript
element = document.getElementsByTagName('*');
for(var i = 0; i < element.length; i++){
var C = element[i].className;
var arr = C.split(' '); //because an element can have more classes and any of them can have background image
for(var j = 0; j < arr.length; j++){
var clas = arr[j];
// here I want something that can find clas has background image or not
}
}
Thanks in advance.