Finding a variables type and the methods attached.
Finding a variables type and the methods attached.
I was looking at the "User selectable rows (multiple rows)" example and wanted to take advantage of the "function fnGetSelected( oTableLocal )" provided but was at a lost to figure out what "type" of object the aReturn variable. Further, I had no clue as to how to track down the methods attached to the object. Can someone point me in the right direction?
This discussion has been closed.
Replies
[code] alert("FISH"+ aReturn );
return false;[/code]
And got the type: HTMLTableRowElement. Now how do I find out what the heck I can do with it? In particular I want to pass this information via a button to the server.
[code]
// DIAGNOSTIC FUNCTION
function dumpObj(obj, name, indent, depth) {
if (depth > MAX_DUMP_DEPTH) {
return indent + name + ": " + depth + "\n";
}
if (typeof obj == "object") {
var child = null;
var output = indent + name + "\n";
indent += "\t";
for (var item in obj)
{
try {
child = obj[item];
} catch (e) {
child = "";
}
if (typeof child == "object") {
output += dumpObj(child, item, indent, depth + 1);
} else {
output += indent + item + ": " + child + "\n";
}
}
return output;
} else {
return obj;
}
}
[/code]
That did the trick along with the DOM and jquery API references:
http://krook.org/jsdom/HTMLTableRowElement.html
http://api.jquery.com/category/manipulation/
console.dir() in Firebug / Webkit's Inspector is awesome for this kind of thing. And doesn't require functions to be included.
Allan