Assuming this structure:
<div id="container">
<div class="sortable">
<div class="box">
<h1>title1</h1>
<h3 class="price">5</h3>
</div>
</div>
<div class="sortable">
<div class="box">
<h1>title2</h1>
<h3 class="price">1</h3>
</div>
</div>
<div class="sortable">
<div class="box">
<h1>title3</h1>
<h3 class="price">3</h3>
</div>
</div>
</div>
How can I sort the elements with the class .sortable to show in ascending/descending order based on the class .price inside of the divs? It should happen when clicking a button.
I know that with arrays I could use the .sort method, but as this is not an array, I don't really know how to approach this.