JSFiddle - React, Tailwind, and code Playground
by roXon
HTML
<div class="grid">
<ul class="list">
<li>Name</li>
<li>Surname</li>
<li>Unit</li>
<li>City</li>
</ul>
<ul class="list">
<li>John</li>
<li>Boe</li>
<li>B.A.</li>
<li>NY</li>
</ul>
<ul class="list">
<li>Jane</li>
<li>Doe</li>
<li>M.A.</li>
<li>CA</li>
</ul>
<ul class="list">
<li>Lin</li>
<li>Zyan</li>
<li>M.A.</li>
<li>OR</li>
</ul>
<ul class="list">
<li>Matt</li>
<li>Albright</li>
<li>M.A.</li>
<li>CA</li>
</ul>
</div>
CSS
.grid ul, .grid ul li {
float: left;
}
.grid ul{
width: 650px;
border-bottom: thin dotted #999999;
clear: both;
margin-bottom: 10px;
padding-bottom: 10px;
}
.grid ul:first-child{
background:#cf5;
}
.grid ul li {
font-size: 11px;
width: 125px;
}
JavaScript
$('.grid ul:gt(0)').each(function() {
var txt1 = $(this).children('li:eq(1)').text();
$(this).data('name', txt1);
});
var items = $('.grid ul');
items.sort(function(a, b) {
var chA = $(a).data('name');
var chB = $(b).data('name');
if (chA < chB) return -1;
if (chA > chB) return 1;
return 0;
});
var grid = $('.grid');
$(grid).append(items);