WordPress.org

Ready to get started?Download WordPress

Forums

SlickQuiz
[resolved] Uncaught TypeError: Object [object Object] has no method 'slickQuiz' (16 posts)

  1. rwparmenter
    Member
    Posted 1 year ago #

    Hey there!

    Currently I am using the non-wordpress plugin of SlickQuiz, and as described in the title, I am experiencing the error Uncaught TypeError: Object [object Object] has no method 'slickQuiz', which is preventing the quiz I have created from rendering. You may find the source code of the page that I'm having problems with at http://coop-workshop.bgsu.wikispaces.net/Section+1+Quiz

    I will provide any other requested resources or answer any questions, just let me know.

    Thanks!

    http://wordpress.org/extend/plugins/slickquiz/

  2. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    Hey @rwparmenter - I just loaded your page and it looks like you got the quiz working! Let me know if you're still having any problems or have any questions.

    Thanks for trying it out!

  3. rwparmenter
    Member
    Posted 1 year ago #

    I was able to solve this problem by adding jQuery.noConflict(); to the beginning of master.js and replacing each instance of $ with jQuery.

    I do have another question though. WIth the project that I am working on, I need to track the progress of users and how they score over multiple quizzes. I plan to use localStorage to keep track of their score across multiple quizzes. My question is that are there such variables, like correctQuestions and totalQuestions, that update after every question? For example, if I were to get question correct, both correctQuestions and totalQuestions would increase by one, which I can then use to update my localStorage variables that already have the number of questions they got right and the number of total questions from previous quizzes.

    I suppose I could just calculate their overall score over multiple quizzes after each one ends, using the score and questionCount varibles from SlickQuiz that display your final score after you complete a quiz. However, I would like to be able to update their score over multiple quizzes after each question.

  4. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    Hi @rwparmenter - If you take a look at the main slickQuiz.js file in the checkAnswer method, you'll see that if an answer is correct I'm simply adding a class of "correctResponse" to the question's list item element (line 201).

    So you could certainly just modify that method to also increment your localStorage variables accordingly. That might be the simplest approach. Hope that helps!

  5. tpederson
    Member
    Posted 1 year ago #

    Hi there, thanks so much for building this plugin and your amazing support on this forum :)

    I have the same error message as rwparmenter:
    Uncaught TypeError: Object [object Object] has no method 'slickQuiz'

    (I also have a similar problem that is talked about in this thread hwere the labels are showing but the content is not: http://wordpress.org/support/topic/plugin-slickquiz-quiz-content-not-displaying-but-labels-are?replies=26)

    In rwparmenter's solution in this thread, he refers to an edit to master.js. I don't see this file in the slickquiz edit area and I'm wondering if the name may have changed recently?

    Here's a link to the WordPress page as well the quiz is on as well:
    http://www.weightlossedmonton.com/emotional-eating-quiz/

    Here's what I've tried so far:
    1. disabled all plugins except slickquiz
    2. put this code in the footer - `<?php
    /* Always have wp_footer() just before the closing </body>
    * tag of your theme, or you will break many plugins, which
    * generally use this hook to reference JavaScript files.
    */

    wp_footer();
    ?>`
    3. As far as I know I'm using the latest version of the plugin

    Any idea what the issue could be?

    Many thanks,
    Travis

  6. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    @tpederson To me it looks like the footer code is missing (your #2). Can you confirm that that bit of code is still in your template? If not, can you add it and let me know so that I can view the page again.

  7. tpederson
    Member
    Posted 1 year ago #

    @jewlofthelotus, thanks for getting back to me. I've added the code to my footer, but I'm pretty sure it was already there as 'wp_footer();'

    Again, here's the website...
    http://www.weightlossedmonton.com/emotional-eating-quiz/

    The following is all the code from my footer.php file copied and pasted with the addition of the code you mentioned:

    <?php
    /* Prevent direct access to this file */
    if ( !defined('WP_CONTENT_DIR') )
    	die('Please do not access this file directly.');
    
    /* WordPress and a lot of plugins require the function in this file, so I guess we have to use it :-(. */
    wp_footer();
    
    /* BEGINNING OF WHAT I ADDED */
    <?php
    /* Always have wp_footer() just before the closing </body>
    * tag of your theme, or you will break many plugins, which
    * generally use this hook to reference JavaScript files.
    */
    
    wp_footer();
    ?>
    /* END OF WHAT I ADDED */
    
    HeadwayDisplay::body_close();
    
    HeadwayDisplay::html_close();
  8. tpederson
    Member
    Posted 1 year ago #

    Oops, I bit of an update here of my footer.php. Adding the whole bit of code caused a php error because I had two of these '<?php'. (open and close I'm guessing) Anyways, here's the code of footer.php updated...

    <?php
    /* Prevent direct access to this file */
    if ( !defined('WP_CONTENT_DIR') )
    	die('Please do not access this file directly.');
    
    /* WordPress and a lot of plugins require the function in this file, so I guess we have to use it :-(. */
    wp_footer();
    
    /* BEGINNING OF WHAT I ADDED */
    wp_footer();
    /* END OF WHAT I ADDED */
    
    HeadwayDisplay::body_close();
    
    HeadwayDisplay::html_close();

    Still no luck and I've tried putting the full code you mentioned and also the smaller version without the '<?php' or '?>' several places like the actual footer of my page, the footer.php (as shown above). I feel quite confident that it's not the 'wp_footer();' at this point, but it could be an issue with the theme I'm using...possible it just doesn't reference the footer.php? Slim chance of that, but I can't think of anything else myself.

  9. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    @tpederson You are correct, it doesn't look like footer.php or the wp_footer method is the culprit. In fact, you can get rid of the code you added - it's calling the method twice now which won't help.

    Can you tell me what version of wordpress you're using, as well as what version of the SlickQuiz plugin? Thanks!

  10. tpederson
    Member
    Posted 1 year ago #

    @jewlofthelotus I've got WordPress version 3.5 and just upgraded the SlickQuiz plugin version to 1.1.1 (had 1.1.0 before) Still no dice after upgrading to 1.1.1.

  11. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    @tpederson - I'd like to have you try modifying one of the plugin files.

    In WordPress, can you:

    1) browse to the Plugin Editor
    2) switch to SlickQuiz via the dropdown selector
    3) select slickquiz/php/slickquiz-front.php from the sidebar
    4) find the following code on line 39-41 and comment it out by prefacing each line with double slashes //


    if ( !strpos( $content, '[slickquiz' ) ) {
    return $content;
    }

    Let me know if that changes fixes it for you. It will not be permanent, but it will help me identify a bug if it exists.

  12. tpederson
    Member
    Posted 1 year ago #

    @jewlofthelotus Success! That totally did it. Is there any problem with me keeping it like it is, or should I change it back?

  13. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    @tpederson - If it works and you want it to keep working, you can keep the change in place. If you update the plugin in the future though, you'll need to make the change again.

    For some background, the lines of code that I had you remove check for the shortcode on the page and only add the necessary scripts if the shortcode is found. This prevents WordPress from loading the scripts on every single page when they're not needed, effectively slowing down page load time.

    I've been aware of this bug that prevents those lines of code from working for a while now, but have not found a solution yet. Hopefully I'll have a fix soon and then you won't have to worry about it! Stay tuned!

  14. tpederson
    Member
    Posted 1 year ago #

    Okay, thanks for all your help so far. I really appreciate it!

  15. jewlofthelotus
    Member
    Plugin Author

    Posted 1 year ago #

    @tpederson - Just pushed out a bug fix that should eliminate all your issues. Please update and let me know if it works for you!

  16. tpederson
    Member
    Posted 1 year ago #

    @jewlofthelotus Success! I just updated and it now works perfectly. Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.