What I want to achieve: All children with an opacity of 0.01 get an increment of 1 in their opacity values.
Problem: As you can see below, this is as far as I got. I cant figure out how to tell js to select all those children elements based on a computed value and add some style to them. I looped through them and got their indexes, as well as their computed values but that is where im stuck now.
HTML:
<div id='a'>
<span>How</span>
<span>are</span>
<span>you?</span>
</div>
JS:
var elem = document.getElementById('a');
for (i = 0; i < 10; i++) {
var x = window.getComputedStyle(elem.children[i], null).getPropertyValue('opacity');
parseFloat(x)[i]
}
Question: How do I add some style to an array of elements that have a specific computed value of a property?