I want to sort a list by price and quality (ascending and descending), by clicking on buttons.
As you can see in this sample I've used "data-x" to assign price and quality value to a product.
I can't do a function in Javascript that works, maybe there's a better way to assign price and quality.
Could you help me to create a function please? Thanks
<ul id="list1">
<li data-price="25" data-quality="8">Product1</li>
<li data-price="9" data-quality="9">Product2</li>
<li data-price="17" data-quality="6">Product3</li>
</ul>