Skip to content

ReferenceError(s) for “define” in jquery.js and for $ #547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
syivanes opened this issue Aug 17, 2014 · 2 comments
Closed

ReferenceError(s) for “define” in jquery.js and for $ #547

syivanes opened this issue Aug 17, 2014 · 2 comments

Comments

@syivanes
Copy link

just started the jQuery tutorial and stuck on the ready event part. Opening the html and file and clicking the "jQuery" link, no alert pop-up comes up like it's supposed to, it goes straight to the jQuery home page instead.

<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Demo</title>
</head>

<body>
    <a href="http://jquery.com/">jQuery</a>
    <script src="jquery.js"></script>
    <script>
    </script>
    <script>
        $( document ).ready(function() {
            $( "a" ).click(function( event ) {
                alert( "Thanks for checking" );
            });
        });


    </script>
</body>
</html>

After checking with Firebug, the two errors are ReferenceError: define is not defined for the jquery.js file and the ReferenceError: $ is not defined for the html file. Inserting javascript/jquery instead of jquery.js into the <script src = ... has helped to get rid of the first ReferenceError, $ is not defined still comes up.

@scottgonzalez
Copy link
Member

I'm not sure what problem you're having, but the article doesn't have any errors in it and copy/pasting your code into an actual page produces no problems: http://jsbin.com/fohiqifezefa/1/edit

Please use IRC, Stack Overflow, or the forums for help.

@syivanes
Copy link
Author

The solution to this turned out to be using the minimized (jquery.min.js) file instead of jquery.js. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants