How do you reference a custom object outside of the function it was created in with JavaScript?

Posted by Jack Roscoe on Stack Overflow See other posts from Stack Overflow or by Jack Roscoe
Published on 2010-06-03T10:03:40Z Indexed on 2010/06/03 10:04 UTC
Read the original article Hit count: 400

Filed under:
|

Hi,

I'm currently using JavaScript and jQuery.

I have an function which executes once the document is ready, and inside that I am creating objects which contain various attributes.

Within the same function, I can access these new object's attributes no problem, however once I'm inside a different function I can't seem to reference them properly and therefore cannot access the objects or the information inside them.

What's the correct way to reference the attributes of an object which was created in a different function to the one looking for the information?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery