[ACCEPTED]-How to do JavaScript object introspection?-introspection

Accepted answer
Score: 30

Your question is a bit vague, so maybe you 9 can provide more details?

As for finding 8 out about an object and the values of its 7 properties, there are many ways to do it, including 6 using Firebug or some other debug tools, etc. Here 5 is a quick and dirty function that might 4 help get you started until you can provide 3 more details:

function listProperties(obj) {
   var propList = "";
   for(var propName in obj) {
      if(typeof(obj[propName]) != "undefined") {
         propList += (propName + ", ");

That will display a list of 2 the properties of the object that you pass 1 it that are not undefined.

Hope that helps...

Score: 0

Is selector the name of the element? If so then 3 you should reference it as:




otherwise it 2 will attempt to look for the (non-existent) "selector" HTML 1 tag and, obviously, not find it.

Score: 0

Though this answer is a bit late, I'd still 1 recommend checking out these links:


More Related questions