I need to sort the below div elements based on fare values. I need to sort based on key:value pair which look like [{key:"1",value=""},{..},{..}]
.
The below snippet is my HTML code
<div class="panel data" key="1" fare="800"></div>
<div class="panel data" key="2" fare="300"></div>
<div class="panel data" key="3" fare="500"></div>
the below structure is how the output I wanted.
[
{key:"2",value:"300"},
{key:"3",value:"500"},
{key:"1",value:"800"}
]
Also I need to reorder the div as per above structure.
Please guide me how to achieve this.