admin管理员组文章数量:1245031
Is it possible using Chrome's debugger (or another debugging tool) to view DOM Elements as objects?
That is, if I create a regular object in Chrome's console, I'm able to inspect its elements.
> o = {}
- Object
- __proto__
- __defineGetter__
- etc
However, if I create a new DOM element, the debugger displays its HTML contents.
> p = document.createElement('p')
<p></p>
I'd like to view the variable p
as an object. Instead of seeing <p></p>
, I'd like to see it's properties (as you do when looking at o
above)
Is this possible in the debugger?
Is it possible using Chrome's debugger (or another debugging tool) to view DOM Elements as objects?
That is, if I create a regular object in Chrome's console, I'm able to inspect its elements.
> o = {}
- Object
- __proto__
- __defineGetter__
- etc
However, if I create a new DOM element, the debugger displays its HTML contents.
> p = document.createElement('p')
<p></p>
I'd like to view the variable p
as an object. Instead of seeing <p></p>
, I'd like to see it's properties (as you do when looking at o
above)
Is this possible in the debugger?
Share Improve this question asked Oct 30, 2012 at 18:13 Alana StormAlana Storm 166k95 gold badges417 silver badges618 bronze badges 1- Does this answer your question? How do I view the properties of a DOM object in Chrome Developer? – ggorlen Commented Jul 19, 2022 at 17:43
1 Answer
Reset to default 15Maybe console.dir()
is what you are after.
> p = document.createElement('p')
<p></p>
> console.dir(p)
- HTMLDivElement
align: ""
...
Image below is from Google Chrome Console Tools docs
本文标签: javascriptViewing DOM Elements as Objects in Chrome debuggerStack Overflow
版权声明:本文标题:javascript - Viewing DOM Elements as Objects in Chrome debugger - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740157649a2233833.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论