I've got pre-created HTML which I cannot edit.
What I am trying to do is get the color of all the bar-appointment
to be the same as the previous bar-something
background-color
I've got the following HTML
<div class="bar-something"><div class="fn-label"> SOMETHING</div> </div>
<div class="bar-appointment"><div class="fn-label"> Ap1</div></div>
<div class="bar-appointment"><div class="fn-label"> Ap2</div></div>
<div class="bar-appointment"><div class="fn-label"> Ap3</div></div>
<div class="bar-something-else"><div class="fn-label"> SOMETHING</div></div>
<div class="bar-appointment"><div class="fn-label"> Ap1</div></div>
<div class="bar-appointment"><div class="fn-label"> Ap2</div></div>
<div class="bar-appointment"><div class="fn-label"> Ap3</div></div>
And jquery
$('.bar-appointment .fn-label').css('color',$('.bar-appointment').prev().children().css('background-color'))
It's not fully working as it only picks the first bar-something
and applies it to the rest. Please see the following JSFIDDLE