The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


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