Object expected

You attempted to invoke a method or property on an object of a type other than Object, or you passed an argument of a type other than Object when an Object was required.

To correct this error

  • Only invoke the method or property on objects of type Object.

  • If the error occurs for a non-object argument, pass an object of type Object.

  • Check whether an undefined or null reference is getting invoked instead of an object of type Object.

    For example, if you get this error on myVar in the following code:

    var str = myVar.toString();  
    

    you can use this code instead:

    if (myVar) {  
        var str = myVar.toString();  
    }  
    

See also

Object Object
Objects and Arrays