Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object Expected error, javascript, jQuery

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
like image 536
Ben Cameron Avatar asked Sep 21 '26 06:09

Ben Cameron


1 Answers

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).

like image 102
Andrzej Doyle Avatar answered Sep 23 '26 19:09

Andrzej Doyle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!