Posted by: Amit Andharia | January 2, 2009

How to get properties of an object?


I was inspired to write this post because I tried a lot to find this out. During debugging I needed it badly. There are many undocumented properties, that you can’t just alert. Sometimes, even you are in need of finding out a property/attribute of the object that accomplish your need. The code snippet below will list all the properties of any object with type. I’m sure this will be quite helpful to others too.

function ListAttributes(obj,debuggerId){

var result = “”;
for (var i in obj)

result += “obj.” + i + ” = ” + obj[i] + “”;



Parameter List:

Obj = object to be reviewed
debuggerId = Id of the div or any other element, insider which you need to write the complete list of all attributes


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: