Reputation: 1473
I want to extract all inline styles of the concerned html.
For example, below is the concerned html for which inline css is to be extracted:
<div id="concernedHtmlPortion" style="style1">
<div style="style2">
<div style="style3;style4">Hello World!!</div>
<div></div>
</div>
Is there any way to extract all style
by using only root id="concernedHtmlPortion"
?
Result of extraction should be: style1,style2,style3,style4
Any help please !!
Upvotes: 2
Views: 738
Reputation: 150263
var allStyles = [];
$('#concernedHtmlPortion, #concernedHtmlPortion [style]').each(function() {
allStyles.push($(this).attr('style').split(';'));
});
alert(allStyles);
Upvotes: 3