JSFiddle - React, Tailwind, and code Playground

HTML

<div class="unsorted">
    <div class="labelimagediv" rel="5"> 
      Div 5 here 
    </div> 
    <div class="labelimagediv" rel="3"> 
       Div 3 Here 
    </div> 
     <div class="labelimagediv" rel="4.5"> 
       Div 4.5 here 
    </div>
    <div class="labelimagediv" rel="4">
      Div 4 Here
     </div> </div>
<button class="btnSort">Sort</button>

JavaScript

$("button.btnSort").click(function () {
    $('div.labelimagediv').sort(function(a, b) {
       return a.getAttribute('rel') > b.getAttribute('rel');
    }).appendTo(".unsorted");
});

function sorter(a, b) {
    return a.getAttribute('rel') - b.getAttribute('rel');
};