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 8501881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:20:00+00:00 2026-06-11T01:20:00+00:00

I am using a jQuery Based Memory Game on my site. It works well

  • 0

I am using a jQuery Based Memory Game on my site. It works well overall but I want a “Play Again” Link and stats at the end to show. I cannot get that code to work. I see this error:

TypeError: $ is not a function
  [Break On This Error]     

    var game = $('div.slashc-memory-game'); // get the game

Here is the JS:

    // this script shows how you can get info about the game
    var game = $('div.slashc-memory-game'); // get the game
    var info = $('p#info').find('span'); // get the info box
    var playAgain = $('a#play-again').css('visibility', 'hidden'); // get the play again link
    // format time like hh:mm:ss
    var formatTime = function(s)
    {
        var h = parseInt(s / 3600), m = parseInt((s - h * 3600) / 60); s = s % 60;
        return (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
    }
    // listen for game 'done' event 
    game.bind('done', function(e)
    {
        // show basic stats
        var stats = game.slashcMemoryGame('getStats');
        info.html('Success ! Number of clicks : ' + stats.numClicks + ', elapsed time : ' + formatTime(parseInt(stats.time / 1000)) + '.');
        playAgain.css('visibility', 'visible'); // show link
    });
    // play again action
    playAgain.click(function(e)
    {
        playAgain.css('visibility', 'hidden'); // hide link
        info.html('Memory Game, click to reveal images'); // reset text
        game.slashcMemoryGame('restart'); // restart game
        e.preventDefault();
    });

Here is a Fiddle

  • 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-06-11T01:20:02+00:00Added an answer on June 11, 2026 at 1:20 am

    Try replacing $() with jQuery() and see if you continue to get this error. The error indicating that it isn’t a function means that either the jQuery file was not loaded yet or the $ name was freed intentionally.

    If jQuery() function doesn’t work, make sure that you are loading the jQuery file before your script block/file.

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

Sidebar

Related Questions

I am using a jQuery Based Memory Game on my site. You can restart
I am using a jquery based rich text editor lwRTE It works well in
I want to make a jQuery based custom popup window for my site using
I'm using a flash/ajax file upload in php based on this site - http://blog.codeville.net/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/
I want to filter a table using jQuery hide/show based on what the user
I created a page that has a JQuery based dialog using the standard JQuery
I am using jquery to duplicate several html fields based on user's selection. However,
I am working with a touch based slideshow for the iPad using Jquery tools
I have a schedule grid based on a HTML table using jQuery/jQuery UI drag
Hai i am generating page numbers based on currentpage and lastpage using jquery ...

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.