I have two divs, that will contain some information about different coffees, Each div will contain some text with span with different values from 1 to 10 to rate different aspects of a coffee like quality of coffee, internet velocity, comfort, etc.
So what I'm trying to achieve is, that once a button from filter container, for example the byQuality button is clicked, then the divs are organized based on the rank of CoffeeQuality span class from highest to lowest.
not sure how to solve the Javascript, actually stuck on html, can someone give me some guidance of where should I been watching? thanks
HTML
<div class="filterBar">
<button class="byQuality" onclick="">COFFEE QUALITY</button>
<button class="byWifi" onclick="">WIFI SIGNAL</button>
<button class="byQuality" onclick="">CHAIR COMFORT</button>
</div>
<div class="coffeeWrapper" id="coffee1">
<h3 class="coffeeTitle">Name of the Coffee</h3>
<p>Coffee Quality:<span id="coffeeQuality">5</span></p>
<p>Wifi Signal:<span id="coffeeWifi">8</span></p>
<p>Chair Comfort:<span id="coffeeComfort">4</span></p>
</div>
<div class="coffeeWrapper" id="coffee2">
<h3 class="coffeeTitle">Name of the Coffee</h3>
<p>Coffee Quality:<span id="coffeeQuality">9</span></p>
<p>Wifi Signal:<span id="coffeeWifi">2</span></p>
<p>Chair Comfort:<span id="coffeeComfort">2</span></p>
</div>
Button By"Something" triggers the re-organization of divs by checking the related Span id and by order from highest rate to lowest?