Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6835471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:14:12+00:00 2026-05-26T23:14:12+00:00

Namaste! My simple issue is that $sortedData becomes undefined in the following code upon

  • 0

Namaste!

My simple issue is that $sortedData becomes undefined in the following code upon execution:

(function($) {
              $.fn.shuffle = function (){
                  var i = this.length, j, temp;
                  if ( i == 0 ) { return; }
                  while ( --i ) {
                      j = Math.floor( Math.random() * ( i + 1 ) );
                      temp = this[i];
                      this[i] = this[j];
                      this[j] = temp;
                  }
              };
            })(jQuery);

// DOMContentLoaded
            $(function() {
              // get the first collection
              var $cards = $('#cards');
              // clone cards to get a second collection
              var $data = $cards.clone();
              // call Quicksand when button clicked
              $('#shuffle').click(function(e) {
                // get all the list items
                var $filteredData = $data.find('li');
                // random sort (shuffling)
                var $sortedData = $filteredData.shuffle();
                // finally, call quicksand
                $cards.quicksand($sortedData, {
                  duration: 600,
                  easing: 'easeInOutQuad'
                });
              });

            });

How this is called: I have a button that, when clicked, executes the above code.

I’ve checked the values in the shuffle function, and prior to the call to the shuffle function, but, when the shuffle function returns, $sortedData is undefined.

The error is probably a noobish one, but, I can’t see it.

Thank you for your input!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:14:12+00:00Added an answer on May 26, 2026 at 11:14 pm

    Your “shuffle” function does not return anything, but you’re treating it as if it does. It appears to shuffle in-place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Namaste, all. I am trying to install Plone 4.1rc3 on Mac OS X Lion
As a beginner I tried to deserialize Google transliterator return array. It's a JSON
In an Excel sheets there is a ton formulas with references to another sheet:
I have a plain text file with many lines. Each line contains 5 words
After installing VS2008, the platform builder mod, and the WM7 aku, VS usually prompts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.