Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 3 of 3

Thread: jQuery - uncaught reference error!

  1. #1

    Afrostyle jQuery - uncaught reference error!

    Ughhhh Annoying... I am using jQuery - and it's not working for me. Very simply I define a function, and call it. Alas - no - I get the uncaught reference error. Maybe I have done something very stupid - but I cant see it.

    THE CODE:
    Code:
    function typer() {	// my code
    };
    var muse = setTimeout('typer()',500); // uncaught reference error!
    SO it's all about where is the jQuery and how it is being initialised .. well ive tried it all ..
    for starters, im loading it at the very end of my code via a 'script.js', just above the </html> .. nd ive tried the following
    Code:
    $(document).ready(function () {// my code
    });
    // U R E
    Code:
    (function($) {// my code
    })(jQuery);
    // U R E
    Code:
    (function() {// my code
    })();
    // U R E

    Banana's! they should all work >... IF I just put the code in script tags - then it works ...
    Any ideas?!

  2. #2
    Why not setTimeout(typer, 500) ? Is line 3 actually in the same scope as the two above it, or did you just combine them for this post?

  3. #3
    well thanks Krilnon - setTimeout(typer, 500) works!
    BUT ALL the javascript documentation that ive read explains the usage function to be called as a string.

    FYI - those above were for examples - and not within the same scope.

    OMT -
    setTimeout("typer()", 500) will work IF I just have the script hardcoded into the HTML. Whereas, when I load it in as a *.js .. then this problem occurs with the function call being a string in the set timeout function.

    K - thanks again - I can leave this meteor shower i've been in .

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012