The system I'm working on generates a li with a contact list, every minute JQuery makes a query to check if it has a message for any users in the list. Currently, if you have a message, the system inserts a class into i within the href and it flashes to indicate a new message.
I want to reposition the li that has a new message in the first position of the list when it has a new message.
For example, when I have a message for so-and-so 4, I want to position the above in the first position in the list.
<li>
<a href="#" data-process-id=1 id="chatByContact" class="chatByContact">Fulano 1<i class="fa fa-comments"></i></a>
</li>
<li>
<a href="#" data-process-id=2 id="chatByContact" class="chatByContact">Fulano 2<i class="fa fa-comments"></i></a>
</li>
<li>
<a href="#" data-process-id=3 id="chatByContact" class="chatByContact">Fulano 3<i class="fa fa-comments"></i></a>
</li>
<li>
<a href="#" data-process-id=4 id="chatByContact" class="chatByContact">Fulano 4<i class="fa fa-comments"></i></a>
</li>