I was making a vanilla javascript bar graph where I made the bar inside the li tag. In the code below, i use the attribute within the li tag to set the height of the bar, but when I try to select the bar from within the li tag. I am unable to do so.
<ul class="GraphWrapper">
<li bar-height="100">
<div class="graph-bar bar"></div>
MON
</li>
<li bar-height="190">
<div class="graph-bar bar"></div>
TUES
</li>
<li bar-height="260">
<div class="graph-bar bar"></div>
WED
</li>
<li bar-height="180">
<div class="graph-bar bar bar-active"></div>
THURS
</li>
<li bar-height="220">
<div class="graph-bar bar"></div>
FRI
</li>
<li bar-height="300">
<div class="graph-bar bar"></div>
SAT
</li>
<li bar-height="50">
<div class="graph-bar bar"></div>
SUN
</li>
</ul>
//JAVASCRIPT
var children=$('.GraphWrapper').children();
for(var i=0;i<children.length;i++){
let hgt = children[i].getAttribute('bar-height');
bar = children[i] > $('.bar');
bar.css('height',hgt+'px');
}
children[i] > $('.bar');returns boolean