Reputation: 554
I'm working on a iPhone project in which I want to change color theme for a given html template.
I want to get an array with color parameter values of style attribute for all tags.
Is there any efficient way to achieve it?
Note: elements in my template does not have id attribute. Also cannot use jquery as is not supported by iOS webview.
Upvotes: 0
Views: 229
Reputation: 20418
Try This
var colorarr=[];
$("*").each(function(){
colorArray.push($(this).css('color'));
});
console.log(colorArray);
Upvotes: 1
Reputation: 71150
If you use jQuery, this can be achieved thus:
var colorArray=[];
$('body *').each(function(){
colorArray.push(this.css('color'));
});
Upvotes: 0