0

So this is a more general question. There are hundred of questions on why this and that returns this error but I want to get a deeper understanding to quicker solve these kind of issues. Or just learn something new. If someone can find a reference to an explanation I will be happy to close the question but I just couldn't find one.

  1. What is it that is missing?
  2. Is it the browsers javascript compiler that throws the error or is it jQuery?
  3. What are the Object[object Object]?
2
  • Probably you can click on that message and see line where it happened. It is hard to diagnose without code. Commented Jan 16, 2013 at 17:20
  • 1
    1) The method name that would follow "...has no method <methodname>" is not a property of the Object. 2) It's not jQuery. 3) Object[object Object] is the default return value of the toString method found on all objects. (almost everything is an object) Commented Jan 16, 2013 at 17:24

2 Answers 2

3

What is it that is missing?

You are trying to call a method of an object which does not exist. For example:

var foo = {};
foo.bar();

If the property does exist, but is not a function, you'll get an error similar to:

TypeError: Property 'bar' of object #<Object> is not a function

Note: Different browser show different error messages, this one is from Chrome.


Is it the browsers javascript compiler that throws the error or is it jQuery?

It's the JavaScript runtime engine. It has nothing to do with jQuery.


What are the Object[object Object]?

[object Object] is the default string representation of objects. Try:

alert({});

You an overwrite it by implementing the toString method:

var foo = {
    toString: function() {
        return "I'm a boring object.";
    }
};
alert(foo);
Sign up to request clarification or add additional context in comments.

Comments

0

[object Object] is what is returned by the default toString method of an object. When you see this error it means that you are trying to call a method on an object which does not have a property with that name, and has not had its toString method overriden.

If you see this message you should check on what line it is occuring using firebug or some other debugging tool, and try to understand why the property name that comes after "method" in the message doesn't exist on the calling object.

This has nothing in particular to do with jQuery. It is simply the default error thrown when a property doesn't exist on an object.

Comments

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.