I think I already missed you haha :)
It's very strange that when i do the function Sort them by Alphabetically content, it's duplicate the div... How I can reach the goal, without duplicating?
(I also would like to order, by date. It's like, each person, will have a date. And in this list, I can show the people by date)
As you can see in the code, I split each object (human) in 1 div. In this case when we move by Nickname, it will also move his lastname. If not, it will do "Angelina Di Caprio" mixing names... haha..
function OrderFunctionNickName() {
$('.nickName').sort(function(a, b) {
if (a.textContent < b.textContent) {
return -1;
} else {
return 1;
}
}).appendTo('.slot');
}
<p class=Click onclick="OrderFunctionNickName()">CLICK test</div>
<div class=slot id=data-1>
<p class=nickName>Mizo</p>
<p class=firstName>Leonardo</p>
<p class=lastName>Di Caprio</p>
<p class=date-messages >31/07/21 [18:15]</p>
</div>
<div class=slot id=data-2>
<p class=nickName>Liou</p>
<p class=firstName>Angelina</p>
<p class=lastName>Jolie</p>
<p class=date-messages>27/07/21 [21:03]</p>
</div>