jquery - shuffling `li` elements within a `ul` -



jquery - shuffling `li` elements within a `ul` -

i want shuffle li elements within ul - , found this working code. don't understand how replacing elements 'in place' instead of adding them end of existing array.

var list = $('ul'); var count = $('ul li').length; (var = 1; < count; i++) { var j = math.floor(math.random() * count); $('li', list).eq(j).appendto(list); }

what behavior of .eq() or .appendto() overlooking in docs makes possible? thanks!

jquery

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -