This is a continuation of a previous question.
I have: var X = $('p');
I’m trying to display on the page itself, what exactly is X[0]. If I use:
JSON.stringify(X)
It tells me that there’s an object there, with a constructor, but not much else.
For a DOM element, like X[0] in this example, how do I display what exactly this object is?
I can loop through X.each and display the html, but there’s so much more to a DOM element than the html. There’s all the attributes that are inherited. There’s probably a length property… I don’t know.
Update: Now I see. I suggest to have a look at Firebug Light. It embeds Firebug in any website. Maybe this helps you to figure out how to simulate
console.log.Or maybe just use it itself?
Use
console.log(X)(reps.console.log(X[0])) . It is either available directly in Webkit (Chrome, Safari) or via Firebug for Firefox (don’t know about IE or Opera, sorry).JSON.stringifydoes not work, because you cannot serialize DOM elements (due to their recursive structure).