Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Sort html elements in Jquery on condition

var result = $('div').sort(function (a, b) {

      var contentA =parseInt( $(a).data('sort'));
      var contentB =parseInt( $(b).data('sort'));
      return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
   });

   $('#mylist').html(result);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Sort #html #elements #Jquery #condition
ADD COMMENT
Topic
Name
3+8 =