3

I'm getting an object expected error in a javascript file. In this case does it mean that the jQuery files aren't included properly?

The line that is causing the error is...

$(function () {

The error in the browser is...

Message: Object expected
Line: 6
Char: 1
Code: 0

1 Answer 1

5

It's possible - if the files weren't included, then the $ variable would indeed not be an object where one was expected. "Object expected" errors usually mean that you have a variable that is null/undefined and then try to call methods on it.

I'd try to find out if this is the case with a simple alert($); and see whether the result is undefined (bad) or something else (probably good).

Sign up to request clarification or add additional context in comments.

1 Comment

Great, I put the alert($) in and it wasn't null. Turned out it was to do with the scripts being included in the wrong order. Thanks for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.