Monday, June 16, 2008

Inspect an element through javascript

Javascript utility function to inspect an element and see the properties and methods attached to it.

function inspect(elm)
{
var str = "";
for (var i in elm)
{
str += i + ": " + elm.getAttribute(i) + "\n";
}
alert(str);
}

table = document.getElementById("tableMain");
inspect(table);

No comments: