Hello!
What you can see on following page is a list of usernames in some random order. I want to use jquery to sort them in this order:
red blue green purple black
http://www.arvag.net/test/sorting/
This is what i did so far:
<script type="text/javascript">
$(function() {
var admin = "rgb(255, 0, 0)";
var moderator = "rgb(00, 00, 255)";
var text = "rgb(00, 128, 00)";
var vip = "rgb(128, 00, 128)";
var adminBuffer = [];
var moderatorBuffer = [];
var textBuffer = [];
var vipBuffer = [];
var html;
$("div#active_users span.name").each(function(i) {
color = $("a span",this).css("color");
html = $(this).html();
if(admin == color){
adminBuffer[i] = "<span class='name'>" + html + "</span>";
}
//$(this).clone().append(" ").appendTo('#rezultat');
});
jQuery.each(adminBuffer, function() {
//alert(this);
$(this).appendTo("#rezultat");
});
});
</script>
I managed to get a match for the red one, but im simply failing to append it to another element with an id of "rezultat".
Any idea or sugestion is welcome!