Grow your CSS skills. Land your dream job.

Last updated on:

Shuffle Children

Nice clean version of a ghetto one that I wrote.

$.fn.shuffleChildren = function() {
    $.each(this.get(), function(index, el) {
        var $el = $(el);
        var $find = $el.children();

        $find.sort(function() {
            return 0.5 - Math.random();




View Demo


  1. this is cool I like it.

  2. Cool, nic1

  3. Steve
    Permalink to comment#

    … and if you want shuffle onload:

    <pre>$(window).load(function() {

    Instead of demo page

    <pre>$(“#shuffle”).click(function() {

    • ryan
      Permalink to comment#

      where would I place this? i am somewhat new to coding…I am using dreamweaver, and I have made a js plugin for the code, but where would I put the ‘usage’ aspect?

Leave a Comment

Posting Code

  • Use Markdown, and it will escape the code for you, like `<div class="cool">`.
  • Use triple-backticks for blocks of code.
      <h1>multi-line block of code</h1>
      <span>be cool yo.</span>
  • Otherwise, escape your code, like <code>&lt;div class="cool"&gt;</code>. Markdown is just easier though.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".