Hi all is this possible.
I am looking to setup a jquery filter could i filter the follow list like this.
<ul>
<li class="5"> filter</li>
<li class="6"> filter</li>
<li class="1"> filter</li>
<li class="5"> filter</li>
<li class="2"> filter</li>
<li class="4"> filter</li>
<li class="7"> filter</li>
</ul>
so after running the filter the outcome would be.
<ul>
<li class="7"> filter</li>
<li class="6"> filter</li>
<li class="5"> filter</li>
<li class="4"> filter</li>
<li class="3"> filter</li>
<li class="2"> filter</li>
<li class="1"> filter</li>
</ul>
i dont now how to filter by number.
<select id="filter" name="filter">
<option value="---">---</option>
<option value="viewed">filter by most viewed</option>
<option value="liked">filter by most liked</option>
</select>
$('#filter').change(function() {
var val = $(this).val();
if(val == 'viewed'){
//dont now what to do here is it possibble
}
return false;
});
Thanks
see http://www.onemoretake.com/2009/02/25/sorting-elements-with-jquery/ for sorting elements with jquery
Or you could just remove all elements beyond
<ul>(with$('ul').html('')and store them in a javascript structure. Then loop through the elements and insert them in the right order. You can get the sort-class-number with the jquery.classselector.